slack-action icon indicating copy to clipboard operation
slack-action copied to clipboard

Add use case examples to README

Open abinoda opened this issue 5 years ago • 8 comments

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

abinoda avatar Jan 25 '19 18:01 abinoda

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 avatar Feb 04 '19 08:02 mrcasals

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 avatar Feb 04 '19 08:02 mrcasals

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

abinoda avatar Feb 04 '19 21:02 abinoda

Yeah, makes sense!

mrcasals avatar Feb 05 '19 07:02 mrcasals

@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

abinoda avatar Feb 05 '19 17:02 abinoda

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

mrcasals avatar Feb 06 '19 07:02 mrcasals

May I ask if this issue is still valid?

jjangga0214 avatar Sep 30 '19 01:09 jjangga0214

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.

eedwards-sk avatar Dec 12 '19 19:12 eedwards-sk