How to run a workflow only if a push option exists?


I want to limit my workflow from running on each push I do and make it run only if the push option “release” exists.

i.e. whenever I run git push -o release the workflow should run

Is there a way a check for the above push option and run [skip ci] within my Github action and allow the commit but prevent the workflow from running?


This is the first time I hear about push options: Git - git-push Documentation

Chances are that this information isn’t exposed to workflows. Even if it was, you would likely need to add if conditions to all your jobs to skip them. There is no support for suppressing workflow runs except for the branches and tags filter. Other events have types that you can select from, but an arbitrary push option wouldn’t fit into this scheme.

The current workaround is to add [skip ci] or similar to the HEAD commit. You don’t need to add anything for that to your workflow, it’s supported natively: