I'm sometimes working on a long running feature branch. And sometimes I need to add some github actions workflow that needs to be run manually, and is specific to that feature. I create a "manual dispatch only" workflow and merge to that feature branch. But...why don't I see that workflow listed in the github actions?
Apparently, workflow needs to exist on the default branch.
But, there's a way with gh cli and a small trick.
If you're working on Windows and having trouble getting the gh
command in bash, try adding alias to bashrc like:
alias gh="/c/Program\ Files/GitHub\ CLI/gh.exe"
You probably won't see your workflow in the list yet: gh workflow ls
If it's not showing up, you can make it show up by adding a "push" trigger to the workflow, push to your branch, remove push trigger, push again and run gh workflow ls
again.
Trigger the workflow like this:
gh workflow run <workflow_name_or_path> --ref branch-name
It's awkward to make a workflow visible like this, but I don't know a better way.
This solution won't make the manual dispatch dropdown show up in the github actions ui, but you can still use the github runner to trigger manual workflows.