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

Feature Request: Get Slack Username from Email #349

Open
4 of 10 tasks
thejeff77 opened this issue Oct 28, 2024 · 3 comments
Open
4 of 10 tasks

Feature Request: Get Slack Username from Email #349

thejeff77 opened this issue Oct 28, 2024 · 3 comments
Labels
question Further information is requested

Comments

@thejeff77
Copy link

Description

I was able to do this in Jenkins, and looking for a way to do it in GHA. I need a way to lookup a slack user's username via their email.

Github actions give context on the committer via email, but obv github doesn't provide slack user data. In order to tag a user directly, being able to lookup the user's slack id so you can tag them or message them directly would be incredibly valuable.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version:

node version:

OS version(s):

Steps to reproduce:

Expected result:

What you expected to happen

Actual result:

What actually happened

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.

@mwbrooks mwbrooks added the question Further information is requested label Oct 28, 2024
@mwbrooks
Copy link
Member

mwbrooks commented Oct 28, 2024

Hey @thejeff77 👋🏻

Thanks for the posting the question - it's a pretty common use-case to try to look up a user based on their email address and totally makes sense that you'd need to do this from our GitHub Action.

Since you've done this in Jenkins, I imagine you're already aware of the Slack API method users.lookupByEmail?

We don't have a slick way of calling this method from the GitHub Action, but we're playing around with a few ideas for you. Hopefully, together we can find a solution for you until slack-github-action@v2 (branch) lands! Expect a follow-up response soon!

@zimeg
Copy link
Member

zimeg commented Oct 28, 2024

@thejeff77 adding to the suggestion of using the users.lookupByEmail method, it should be possible to make this call with a curl request and scoped token like so:

    - name: Find the Slackbot user ID
      run: |
        curl -X POST -H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}" \
          -H "Content-type: application/json" \
          --data '{"email":"[email protected]"}' \
          https://slack.com/api/users.lookupByEmail

Although making use of the response might require a bit of bash magic in this step...

As @mwbrooks mentioned, we're chipping away at @v2 of this GitHub Action which will have more support for calling Slack API methods and making use of these responses in later steps.

We'll check that this method works well in these updates and will continue to share updates with changes for that version!

@thejeff77
Copy link
Author

@zimeg looking forward to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants