abinoda / slack-action

GitHub Action for posting Slack messages
MIT License
270 stars 37 forks source link

Add use case examples to README #1

Open abinoda opened 5 years ago

abinoda commented 5 years ago

It'd be nice to add a full example workflow, e.g. posting messages about opened and merged pull requests to a Slack channel.

mrcasals commented 5 years ago

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.

mrcasals commented 5 years ago

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.

abinoda commented 5 years ago

@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.

mrcasals commented 5 years ago

Yeah, makes sense!

abinoda commented 5 years ago

@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

mrcasals commented 5 years ago

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

jjangga0214 commented 5 years ago

May I ask if this issue is still valid?

eedwards-sk commented 4 years ago

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.