Search code examples
github-actions

GitHub Actions PR workflow development routine


I'm working on GitHub actions that only get triggered by pull_request events. Wondering if there is a better "dev experience" than what I'm currently doing.

My understanding is that the workflow file must be in the base branch. So in order to test workflow changes, I gotta push code to the base branch, then trigger the workflow via the head branch.

Assume I've already got my-base and my-head branches, with a pull request set up. I trigger the workflow via syncronization events, by pushing to the head branch:

git checkout my-base
git add . && git commit -m "plx work" && git push
git checkout my-head
git merge my-base --no-edit && git push

Is there a better way?


Solution

  • That's not true for the trigger pull_request. It is enough for this trigger to be on the branch associated with your pull request -- no need to put it in the base branch.

    pull_request_target, however, needs to be in the base branch to name an example. –