Closed rafaelrsilva closed 3 years ago
Hey @rafaelrsilva
Unfortunately, repository_dispatch
events (which this action uses) only trigger on the default branch.
Apparently Github has released a new event type since I wrote this action called workflow_dispatch
that can trigger workflows on non-default branches. Maybe you could check those out, there's probably an action in the marketplace that sends those.
Here's a link that might be useful. Hope that helps!
I'm using workflow_dispatch
. In fact, I was trying to trigger repository_dispatch
from workflow_dispatch
.
Unfortunately, even calling workflow_dispatch
from another branch, repository_dispatch
is always triggered on default branch.
My workaround for that situation was to send commit's SHA alongside the additional data and checkout repository from that commit.
- name: Trigger another workflow
uses: mvasigh/dispatch-action@main
with:
token: ${{ secrets.ACCESS_TOKEN }}
event_type: event
message: |
{
"sha": "${{ github.sha }}"
}
- uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.message.sha }}
persist-credentials: false
I think this solves my problem, for now. Thanks for replying, @mvasigh! 👍
Nice, that's a clever solution! Glad you could get it working.
When I run a workflow from a branch A, and that workflow triggers a repository_dispatch workflow, the latter ends up running from the last commit on the default branch, not branch A.
Is there a way to trigger workflow by specifying a branch?