Skip to content

action/checkout@v4 checking out wrong code #1581

Closed
@kopax-polyconseil

Description

@kopax-polyconseil

This is our first step in our workflow:

      - uses: actions/checkout@v4

This is how it look like in our logs:

image

The problem we have :

  • master is the latest state
  • we created a branch from a tag older than master since one of our CD failed, to trigger the deployment job manually from that branch
  • it appears that actions/checkout@v4 is checking out something closer to master than our branch (since our package.json checkout include the same version as master)

This is the relevant log:

2024-01-03T09:26:43.2471721Z ##[group]Run actions/checkout@v4
2024-01-03T09:26:43.2472204Z with:
2024-01-03T09:26:43.2472748Z   repository: pass-culture/pass-culture-app-native
2024-01-03T09:26:43.2473366Z   token: ***
2024-01-03T09:26:43.2473722Z   ssh-strict: true
2024-01-03T09:26:43.2474127Z   persist-credentials: true
2024-01-03T09:26:43.2474539Z   clean: true
2024-01-03T09:26:43.2474902Z   sparse-checkout-cone-mode: true
2024-01-03T09:26:43.2475372Z   fetch-depth: 1
2024-01-03T09:26:43.2475703Z   fetch-tags: false
2024-01-03T09:26:43.2476027Z   show-progress: true
2024-01-03T09:26:43.2476438Z   lfs: false
2024-01-03T09:26:43.2476755Z   submodules: false
2024-01-03T09:26:43.2477177Z   set-safe-directory: true
2024-01-03T09:26:43.2477547Z ##[endgroup]
2024-01-03T09:26:43.4156251Z Syncing repository: pass-culture/pass-culture-app-native
2024-01-03T09:26:43.4159098Z ##[group]Getting Git version info
2024-01-03T09:26:43.4160729Z Working directory is '/home/runner/work/pass-culture-app-native/pass-culture-app-native'
2024-01-03T09:26:43.4162621Z [command]/usr/bin/git version
2024-01-03T09:26:43.4163315Z git version 2.43.0
2024-01-03T09:26:43.4176222Z ##[endgroup]
2024-01-03T09:26:43.4193937Z Temporarily overriding HOME='/home/runner/work/_temp/eefdcbd8-e3bf-474f-a1d8-3ead2f9fa222' before making global git config changes
2024-01-03T09:26:43.4195910Z Adding repository directory to the temporary git global config as a safe directory
2024-01-03T09:26:43.4198182Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/pass-culture-app-native/pass-culture-app-native
2024-01-03T09:26:43.4232559Z Deleting the contents of '/home/runner/work/pass-culture-app-native/pass-culture-app-native'
2024-01-03T09:26:43.4237950Z ##[group]Initializing the repository
2024-01-03T09:26:43.4240956Z [command]/usr/bin/git init /home/runner/work/pass-culture-app-native/pass-culture-app-native
2024-01-03T09:26:43.4300403Z hint: Using 'master' as the name for the initial branch. This default branch name
2024-01-03T09:26:43.4301937Z hint: is subject to change. To configure the initial branch name to use in all
2024-01-03T09:26:43.4303399Z hint: of your new repositories, which will suppress this warning, call:
2024-01-03T09:26:43.4304395Z hint: 
2024-01-03T09:26:43.4305260Z hint: 	git config --global init.defaultBranch <name>
2024-01-03T09:26:43.4306431Z hint: 
2024-01-03T09:26:43.4307419Z hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
2024-01-03T09:26:43.4309152Z hint: 'development'. The just-created branch can be renamed via this command:
2024-01-03T09:26:43.4310259Z hint: 
2024-01-03T09:26:43.4310903Z hint: 	git branch -m <name>
2024-01-03T09:26:43.4312788Z Initialized empty Git repository in /home/runner/work/pass-culture-app-native/pass-culture-app-native/.git/
2024-01-03T09:26:43.4324176Z [command]/usr/bin/git remote add origin https://github.com/pass-culture/pass-culture-app-native
2024-01-03T09:26:43.4357398Z ##[endgroup]
2024-01-03T09:26:43.4358110Z ##[group]Disabling automatic garbage collection
2024-01-03T09:26:43.4360200Z [command]/usr/bin/git config --local gc.auto 0
2024-01-03T09:26:43.4388452Z ##[endgroup]
2024-01-03T09:26:43.4389054Z ##[group]Setting up auth
2024-01-03T09:26:43.4393677Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2024-01-03T09:26:43.4422711Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2024-01-03T09:26:43.4708973Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2024-01-03T09:26:43.4737032Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2024-01-03T09:26:43.4967133Z [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
2024-01-03T09:26:43.5001147Z ##[endgroup]
2024-01-03T09:26:43.5002151Z ##[group]Fetching the repository
2024-01-03T09:26:43.5011671Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +7e314d76e16e12c963fc04b4fe085668a59be567:refs/remotes/pull/5769/merge
2024-01-03T09:26:44.7295235Z From https://github.com/pass-culture/pass-culture-app-native
2024-01-03T09:26:44.7296153Z  * [new ref]         7e314d76e16e12c963fc04b4fe085668a59be567 -> pull/5769/merge
2024-01-03T09:26:44.7320430Z ##[endgroup]
2024-01-03T09:26:44.7321042Z ##[group]Determining the checkout info
2024-01-03T09:26:44.7322338Z ##[endgroup]
2024-01-03T09:26:44.7323014Z ##[group]Checking out the ref
2024-01-03T09:26:44.7326933Z [command]/usr/bin/git checkout --progress --force refs/remotes/pull/5769/merge
2024-01-03T09:26:44.9962016Z Note: switching to 'refs/remotes/pull/5769/merge'.
2024-01-03T09:26:44.9962688Z 
2024-01-03T09:26:44.9963312Z You are in 'detached HEAD' state. You can look around, make experimental
2024-01-03T09:26:44.9964591Z changes and commit them, and you can discard any commits you make in this
2024-01-03T09:26:44.9965960Z state without impacting any branches by switching back to a branch.
2024-01-03T09:26:44.9966644Z 
2024-01-03T09:26:44.9967171Z If you want to create a new branch to retain commits you create, you may
2024-01-03T09:26:44.9968683Z do so (now or later) by using -c with the switch command. Example:
2024-01-03T09:26:44.9969445Z 
2024-01-03T09:26:44.9969795Z   git switch -c <new-branch-name>
2024-01-03T09:26:44.9970222Z 
2024-01-03T09:26:44.9970447Z Or undo this operation with:
2024-01-03T09:26:44.9970928Z 
2024-01-03T09:26:44.9971128Z   git switch -
2024-01-03T09:26:44.9971544Z 
2024-01-03T09:26:44.9972063Z Turn off this advice by setting config variable advice.detachedHead to false
2024-01-03T09:26:44.9972871Z 
2024-01-03T09:26:44.9973540Z HEAD is now at 7e314d7 Merge d23cb9ae7d8eeb6bf25905827ce35cffcc931add into b07cc5fc2e46af3d2d8dba28e620ab913ebd1c29
2024-01-03T09:26:44.9980979Z ##[endgroup]
2024-01-03T09:26:45.0022631Z [command]/usr/bin/git log -1 --format='%H'
2024-01-03T09:26:45.0045675Z '7e314d76e16e12c963fc04b4fe085668a59be567'

If you look at our package.json for all those sha logged by actions/checkout@v4:

On my branch, this is how the history look like, and how I expect actions/checkout@v4 to checkout :

image

This is our workflow https://github.com/pass-culture/pass-culture-app-native/blob/master/.github/workflows/dev_on_workflow_web_deploy.yml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions