-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
In case of on pull request event,
With default settings,
use: actions/checkout@v3
As input option reference is empty, reference and SHA will be filled up with github context.
In case of workflow re-run, github context is same with initial workflow run context - https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs
If commit id is not empty we use commit-id to make refSpec and fetch the specific merge reference's commit. - https://github.com/actions/checkout/blob/main/src/ref-helper.ts#L93
So workflow checkout act as deterministic and does not match with target branch's latest commit if changed.
But if we made any new commit to PR, it will work as expected. (As commit id changed, fetch the merged version of latest target branch)
It works like checkout workflow cache the result internally as #696 and #461 mentioned.
We use github actions to CI and many tester and verifier.
In case of default branch's test code failed, we made a new pull request and merge to fix test failure.
But We have to tell all other PR's author to made a any new commit or rebase and force push to pass the test.
So we made little trick like
use: actions/checkout@v3
with:
ref: ${{ github.ref }}
just as same with actual reference
Checkout workflow run as non-deterministic but good for deal with target-branch's test failure.
So I think it will be great if there will be some document like checkout will not follow the target branch's latest commit in case of workflow re-run and you can make it follow by putting same reference as option.
Or to make it more understandable, how about provide a new option to choose whether use commit or use reference when fetching
I'm not sure this is a big issue, but please consider some document or options. Thank you in advance.