I have a workflow which triggers a build when a PR is opened and the workflow is similar to below.
on: pull_request: branches: - master ... jobs: build: steps: - uses: actions/checkout@v1 with: ref: master
My question is, when we create a pull request from a forked repository to the main repository, is the triggered build will be done on the main repository branch (master branch in this case) after applying the pull request ?
In my case, it doesn't seem like the build happens with the PR content applied. The reason is, I created a PR with a fix for a unit test failure, but the triggered build's test case failed due to not having that fix. However once the PR was mergerd, the subsequent PR builds were successful.
Highly appriciate some input on the build behavior.
Solved! Solved! Go to Solution.
If you add with.ref , it will check out the specific branch. In your example, it checked out master branch. It didn’t include your pull request content.
Please remove with.ref from actions/checkout@v1
with: ref: master
- uses: actions/checkout@v1
By default, the branch or tag ref that triggered the workflow will be checked out. If the workflow is triggered by pull request, then refs/remotes/pull/[id]/merge will be checkout.
For more detail info, please refer to Checkout Action document > https://github.com/actions/checkout#usage