Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
replace pairs separation as it can conflict some some usernames
Browse files Browse the repository at this point in the history
  • Loading branch information
zegnus committed Jan 15, 2020
1 parent f151f5b commit 92418fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ You can also mention users by providing the necessary information described in t

### mentionPairs

Provide a list of githubUsername-slackMemberId comma separated
Provide a list of githubUsername::slackMemberId space separated

> ferran-U0111, clara-U0121
> ferran::U0111 clara::U0121
When this field is populated then all githubUsername's that appear in the **text** field will be mentioned in slack

Expand All @@ -41,5 +41,5 @@ When this field is populated then all githubUsername's that appear in the **text
color: danger
text: This is a danger example text for ferran
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
mentionPairs: ferran-U0111, clara-U0121
mentionPairs: ferran::U0111 clara::U0121
```
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
description: 'Your slack channel webhook'
required: true
mentionPairs:
description: 'A list of githubUsername-slackMemberId comma separated to use for mentioning a githubHusername in the text field in Slack'
description: 'A list of githubUsername::slackMemberId space separated to use for mentioning a githubHusername in the text field in Slack'
required: false
runs:
using: 'docker'
Expand Down
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# 1. color
# 2. text
# 3. webhook
# 4. usernameslackmap: "carlos-abc, jose-123"
# 4. usernameslackmap: "carlos::abc jose::123"

# ./entrypoint.sh "good" "Hello zegnus" "https://hooks.slack.com/services/..." "true" "zegnus-U000000, laith-U11111"

Expand All @@ -13,11 +13,11 @@ textInput=${2}
if [ ! -z "$4" ]
then
gitSlackPair=${4}
arrayGitSlack=($(echo $gitSlackPair | tr ',' "\n"))
arrayGitSlack=($(echo $gitSlackPair | tr ' ' "\n"))

for i in "${arrayGitSlack[@]}"
do
gitSlack=($(echo $i | tr '-' "\n"))
gitSlack=($(echo $i | tr '::' "\n"))
gitName=${gitSlack[0]}
slackCode=${gitSlack[1]}
textInput="${textInput/$gitName/<@$slackCode>}"
Expand Down

0 comments on commit 92418fd

Please sign in to comment.