diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f17b3fb..50f8996 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/README.md b/README.md index 20318e9..c725b5a 100644 --- a/README.md +++ b/README.md @@ -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 ? diff --git a/Screenshot.png b/Screenshot.png new file mode 100644 index 0000000..d4f4e39 Binary files /dev/null and b/Screenshot.png differ diff --git a/main.go b/main.go index 0d3b236..3d225bd 100644 --- a/main.go +++ b/main.go @@ -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 + ")"