slack-action
slack-action copied to clipboard
Add use case examples to README
It'd be nice to add a full example workflow, e.g. posting messages about opened and merged pull requests to a Slack channel.
Hi!
Coming from https://github.community/t5/GitHub-API-Development-and/GitHub-Actions-get-the-PR-ID-that-started-it/m-p/18444#M812
My use case is this: since GitHub notifications is kinda messy and it's hard to notice that something's happened, I want to be able to send a message on Slack when a PR is open. The message should, at last, include the link to the PR and the GitHub user that opened it.
As explained on the link, maybe we could create an action that sets env variables based on the contents of the GITHUB_EVENT_PATH
file, and use those variables as arguments for your action.
Maybe something like MY_VAR "json.path[0].to.relevant.content"
, this would use jq
to get the specified contents of the file and set the value to MY_VAR
env variable. Then in I'd use $MY_VARV
as inputs of this image.
@mrcasals
Makes sense. Yeah, I'm working on a way to allow flexible event object access via the arguments to this GitHub Action. So the arg could be something like New pull request opened: ${pull_request.title}
, and the Action would automatically parse the argument and attempt to substitute the event object value for ${pull_reqeust.title}
.
Does that make sense? Let me know your thoughts.
Yeah, makes sense!
@mrcasals
I think this will be difficult to do without the ability to filter workflows to specific event actions as described here. It looks like GitHub is working on this, though. cc: @jessfraz
There's a GitHub action for this:
action "On review submission" {
uses = "actions/bin/filter@c6471707d308175c57dfe91963406ef205837dbd"
args = "action submitted"
}
https://github.com/actions/bin/tree/c6471707d308175c57dfe91963406ef205837dbd/filter
May I ask if this issue is still valid?
What happened to this issue?
The linked issue about needing env var support is still valid, yet was closed in favor of this.
Edit: Ahh, just looked at the source. This project is a joke -- it's literally just wrapping a single curl command. Not even worth using as an action.