Question about 'on pull_request' build workflow behavior #25823
-
I have a workflow which triggers a build when a PR is opened and the workflow is similar to below.
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. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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
Just use
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 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the detailed answer. I have done the suggested changes. |
Beta Was this translation helpful? Give feedback.
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
Just use
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