Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No translations to Slack usersid #5

Open
ASarco opened this issue Feb 25, 2021 · 5 comments
Open

No translations to Slack usersid #5

ASarco opened this issue Feb 25, 2021 · 5 comments

Comments

@ASarco
Copy link

ASarco commented Feb 25, 2021

Hi, I've been trying to use this, but seems like the GitHub names are not being translated.

I have my translation table in a secret SLACK_USER, it looks like this:
ASarco,U01CXS1NVDG
Then the title in the action is:
BODY: '@${{ github.actor }} your recent action ${{ github.workflow }} has been built succesfully!'
TITLE: ':tada: Congratulations ${{ github.actor }} :tada:'

So I assumed my name coming from github.actor should be translated to the Slack user. But the message in Slack looks like this:

🎉 Congratulations ASarco 🎉
@ASarco your recent action Customers Java CI with Maven has been built succesfully!

What am I doing wrong?

@ry-itto
Copy link
Owner

ry-itto commented Feb 25, 2021

@ASarco
Hi.

Did you set SLACK_GITHUB_USER_PAIRS environment variable?
The secret SLACK_USER should set to SLACK_GITHUB_USER_PAIRS environment variable.

Sorry for the confusing parameter names.
I hope this solves it.

@ASarco
Copy link
Author

ASarco commented Feb 25, 2021

Yes, I did all that. This is the complete step:

- name: Slack Notification
  with: 
    status: ${{ job.status }}
  if: success()
  uses: ry-itto/[email protected]
  env:
    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
    SLACK_ICON_URL: 'https://github.githubassets.com/images/modules/logos_page/Octocat.png'
    SLACK_USERNAME: 'GitHub'
    SLACK_GITHUB_USER_PAIRS: ${{ secrets.SLACK_USER }}
    TITLE: ':tada: Congratulations ${{ github.actor }} :tada:'
    BODY: '@${{ github.actor }} your recent action ${{ github.workflow }} has been built succesfully! The new version is ${{ steps.gitversion.outputs.fullSemVer }} :partyparrot:'
    COLOR: '#4D88C2'

So everything looks good. The only thing is I've seen in your tests, that there is no tests for when there are more than one line of names pairs. Maybe there's a problem with that? I have 6 names in my list.

@ry-itto
Copy link
Owner

ry-itto commented Feb 26, 2021

Exactly, that is correct.

When I add test case of multiple slackUsernames, npm test was failed...

I will fix it. 🙇🏼

ry-itto pushed a commit that referenced this issue Feb 26, 2021
@ry-itto
Copy link
Owner

ry-itto commented Feb 26, 2021

Hi @ASarco .

I fixed about this. Please try to use bellow 🙇🏼

- name: slack_notify_actions
  uses: ry-itto/[email protected]

I hope this release works.

@ASarco
Copy link
Author

ASarco commented Mar 1, 2021

hi @ry-itto
Thanks for doing a quick fix, however, it's still not quite working.
To make it work I had to change the end of line in the users list to CR only, since I see that your source code splits the list using '\n'
It would be nice if it works for any end of line type, such as '\r\n', '\n' or '\r' , so it'll work with data coming from all operative systems.

Thanks.

ry-itto pushed a commit that referenced this issue Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants