-
Hi all! I’m starting with GitHub Actions, and I wanted to send a Slack notification when a PR review was submitted. This is the workflow I’m using:
I checked the available environment variables, but I can’t seem to find any that returns this info. Am I missing something? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Hi @mrcasals! You should be able to get this information by looking at the file located at the environment variable GITHUB_EVENT_PATH, you can find more information on that here: https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables This should contain information about the Pull Request that has triggered your action. If I’m misreading anything, let me know! |
Beta Was this translation helpful? Give feedback.
-
@mrcasalsCan you post your use case here? I’m working on creating example workflows similar to what you’re describing. |
Beta Was this translation helpful? Give feedback.
-
Done, thanks! Maybe it’s better if we use an action to set some env variables based on the |
Beta Was this translation helpful? Give feedback.
-
Hi @nickvanw! Thanks for your reply! I didn’t realize the I see that “any action can create […] environment variables”, as per the link you posted. Could we create an action that sets env variables based on the contents of the file, and then use those variables as args for the action that sends the message? |
Beta Was this translation helpful? Give feedback.
-
@mrcasalsI think we’re thinking along the same lines. I responded to your comment on that issue. If you’d like, maybe close this ticket here and we can continue collaborating on the issue thread? |
Beta Was this translation helpful? Give feedback.
-
Hey @mrcasals! It looks like you’re already working with @abinoda, but if you look inside of that file you’ll find that it matches the same format that’s documented for our webhooks (https://developer.github.com/v3/activity/events/types/) - so if you’re looking at PRs, for example, it should follow the same format here: https://developer.github.com/v3/activity/events/types/#pullrequestevent From there, you should be able to parse it as JSON and extract the data yourself. It looks like @abinoda is working on a generic way to extract these, but you should be able to use your language of choice to parse the information you need from that file. |
Beta Was this translation helpful? Give feedback.
-
I have just started experimenting with this… action “GitHub Action for Slack” { I want a link to the PR in the args |
Beta Was this translation helpful? Give feedback.
Hi @mrcasals!
You should be able to get this information by looking at the file located at the environment variable GITHUB_EVENT_PATH, you can find more information on that here: https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables
This should contain information about the Pull Request that has triggered your action.
If I’m misreading anything, let me know!