I have a workflow which is executed on push. Is there any way to read some flags from the push command? So, I will push like this on my local computer
git push origin my-branch --do-something
I want to pass the flag (if available) --do-something
as it is into my Action like
...
- name: Custom cmd
run: yarn my:script:cmd --do-something # its passed here
...
CodePudding user response:
I am afraid it's not possible like this.
Depending on what you exactly need to trigger and how complicated things you want to pass, the most common solutions are:
Trigger workflows based on
tags
and encode options into tags themselves - so for example to identify if workflow should make public or internal build, by having the proper format of tag.Pass information in message commit. You can encode the command as [-do-something] in GIT message and then parse it inside the workflow.
For example:
if: contains(github.event.commits[0].message, '[run_test_workflow]')
Use dispatch_workflow event in GitHub to directly trigger desired workflow with all possible inputs - probably most flexible - could be integrated with post-commit hooks.