-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR Checkout bug or misunderstanding? #626
Comments
Ok, so it seems like to fix this case adding: I am still confused then when that is needed. According to the docs that shouldn't be needed on a PR: https://github.com/actions/checkout#checkout-pull-request-on-closed-event |
It is confusing to experience but probably the correct behaviour desired for CI usually. See this related issue. You can still perform a diff with git on the default merge commit to identify what files in the history the PR is actually contributing, that would identify The reason for preferring the newer history being present, is to ensure that any functionality being added doesn't break when merged to the base branch (eg: Although the PR itself seemed fine and any tests run were successful, after merging the tests may fail on future PRs (or a release/build of That can occur due to another change on the base branch (be that another merged PR or direct push like your When that is not a concern for your PR workflow, then you can ignore the default ref, and choose the In some cases such as linting changes from the PR, you may prefer that. But you could still identify (from the merge commit with a An example would be for docs: Adding a relative link to another document or a non-perma link on your github repo which has since been moved (or renamed due to some accidental typo in the filename). Without the default merge commit, your workflow on the PR would not catch that issue, and your checks would pass, but then it's broken again once the PR is merged. |
Hello,
We have been using actions with checkout for a while now, and we just noticed that either we weren't using it right or there is a bug in the latest v2. We run a workflow on every commit to a PR against master like the example here: https://github.com/actions/checkout#checkout-pull-request-on-closed-event
We created a repo to show the issue: https://github.com/Marketron/CheckoutTest
Sequence of events (can be seen in the commit log):
MyFirstCheckInToMaster.md
pr.yml
the workflow is simple, on any commit to a PR (against master) it will checkout the PR and runls -al
https://github.com/Marketron/CheckoutTest/blob/master/.github/workflows/pr.yml. The action seems to only checkout the PR code, as expected, as seen in the action log:/usr/bin/git checkout --progress --force refs/remotes/pull/1/merge
SecondMasterCheck.md
CheckIntoTestPrBranch.md
ls -al
command in it: https://github.com/Marketron/CheckoutTest/runs/4023463428?check_suite_focus=true#step:3:11Expected result:
Should only list two files:
MyFirstCheckInTiMaster.md
&CheckIntoTestPrBranch.md
Actual result:
Lists 3 files including
SecondMasterCheck.md
as seen here: https://github.com/Marketron/CheckoutTest/runs/4023463428?check_suite_focus=true#step:3:11So is this a bug or have we been wrong on how PR checkout works or the params we need to send to
actions/checkout@v2
?The text was updated successfully, but these errors were encountered: