Skip to content

Commit

Permalink
Merge pull request #7 from GokulDas027/dev
Browse files Browse the repository at this point in the history
fix . parsing issue
  • Loading branch information
GokulDas027 authored Oct 3, 2020
2 parents 3473eba + fa2dcdf commit 6846498
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Notifier
uses: GokulDas027/TelegramBridge@master
uses: GokulDas027/TelegramBridge@dev
if: always()
with:
chat: ${{ secrets.chat }} # save your chat id at settings/secrets with name: chat
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

## How does the message looks like ?

![Sample Message](https://drive.google.com/uc?export=view&id=1TsZZi9yS6qC_oQVdoOrRLbL8Zq6WeMqE)
![Sample Message](Screenshot.png)

## What's next ?

Expand Down
Binary file added Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 9 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ func composer(status, event, actor, repo, workflow, link string) string {
"success": "✅✅✅",
}

// removing underscore from event name to avoide markdown parser error
event = strings.ReplaceAll(event, "_", " ")
event = strings.ReplaceAll(event, "-", " ")
event = strings.ToUpper(event)
repo = strings.ReplaceAll(repo, "_", "\\_")
repo = strings.ReplaceAll(repo, "-", "\\-")
actor = strings.ReplaceAll(actor, "_", "\\_")
actor = strings.ReplaceAll(actor, "-", "\\-")

replacer := strings.NewReplacer("_", "\\_", "-", "\\-", ".", "\\.")

// removing symbols to avoide markdown parser error
event = replacer.Replace(event)

repo = replacer.Replace(repo)

actor = replacer.Replace(actor)

// Message text composing
text = icons[strings.ToLower(status)] + " *" + event + "*\n"
text = icons[strings.ToLower(status)] + " *" + strings.ToUpper(event) + "*\n"
text += "was made at " + repo + " \nby " + actor + "\n"
text += "Check here " + "[" + workflow + "](" + link + ")"

Expand Down

0 comments on commit 6846498

Please sign in to comment.