Skip to content

on pull request, checkout@v2 built some ref other than the one that was claimed #237

Closed

Description

@jepler

Recently, I had a PR adafruit/circuitpython#2831 which checked out green, so a fellow developer merged it. It broke the build.

In subsequent investigation, I noticed that while the linked Actions run https://github.com/adafruit/circuitpython/runs/633447824?check_suite_focus=true shows that it was building the same ref as the one that was merged, down in the logs you find something different.

Under the step "Run actions/checkout@v2", "Checking out the ref",

HEAD is now at e7eef6f0c Merge 6dfe9ab606352b36f8d295b250ac7118c459618b into 2d7cf4b792afa1b6755b9575b84cae4b65ae7ab9

6dfe9ab represents another revision of the code that was apparently replaced by force-push with the later value 75be728:

@jepler force-pushed the jepler:rgbmatrix-stm branch from 6dfe9ab to e5be728 7 days ago

Activity

  1. ericsciple commented on May 7, 2020

    @ericsciple
    Contributor

    Thanks! I'll loop in some folks.

    Indeed something looks wrong.

    From the mpy-cross-mac check run, the step "Dump GitHub context" reveals some key info:

    {
      [...]
      "ref": "refs/pull/2831/merge",
      "sha": "e7eef6f0ca41e82a3082df79b7abbd6a369433a6",
      "repository": "adafruit/circuitpython",
      "event_name": "pull_request",
      [...]
      "event": {
        "action": "synchronize",
        "after": "e5be728c1c8a3a455b7095c9dab9e758c5016191",
        "before": "6dfe9ab606352b36f8d295b250ac7118c459618b",
        "number": 2831,
        [...]
    

    Yet appears to contradict the git log -1 output at the end of the step "Run actions/checkout@v2":

    /usr/local/bin/git log -1
    commit e7eef6f0ca41e82a3082df79b7abbd6a369433a6
    Merge: 2d7cf4b79 6dfe9ab60
    Author: Jeff Epler <[email protected]>
    Date:   Wed Apr 29 19:23:50 2020 +0000
    
        Merge 6dfe9ab606352b36f8d295b250ac7118c459618b into 2d7cf4b792afa1b6755b9575b84cae4b65ae7ab9
    

    It looks like ${{ github.sha }} is the old merge commit.

    [edit]: The commit message should read: Merge e5be728c1c8a3a455b7095c9dab9e758c5016191 into 2d7cf4b792afa1b6755b9575b84cae4b65ae7ab9 (since e5be7 is the "after" sha)

  2. ericsciple commented on May 12, 2020

    @ericsciple
    Contributor

    @andymckay have you heard of any similar occurrences?

    The workflow payload contained the wrong merge commit.

  3. self-assigned this
    on May 19, 2020
  4. iheanyi commented on May 19, 2020

    @iheanyi

    👋🏾 Will be taking a look into this today and tomorrow.

  5. ericsciple commented on May 19, 2020

    @ericsciple
    Contributor

    Thanks @iheanyi for digging into this! We dug into this a bit and are unable to reproduce. This may be due to replication lag (received previous merge commit). Going forward we'll add more telemetry to the checkout step. So if this happens again we will be able to detect from telemetry.

  6. added a commit that references this issue on Jun 7, 2020
  7. Bankst commented on Jul 7, 2020

    @Bankst

    Hi, I just ran in to this same issue here:
    PhotonVision/photonvision@f2305bb
    The SHA for the commit is f2305bb501ec200d022a1bac4bac8ee316f68e54 but the workflow ran with commit 2e69b3e24b82faefc3702fc946834c61b31d8c4

    https://github.com/PhotonVision/photonvision/pull/18/checks?check_run_id=844516246
    Hopefully this can somehow help, having another known occurence

  8. kenorb commented on Jul 13, 2020

    @kenorb

    Same happens when using with ad-m/github-push-action, related:

  9. kenorb commented on Jul 13, 2020

    @kenorb

    My configuration is like:

      Push:
        if: github.event_name == 'pull_request'
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
            with:
              persist-credentials: false
              # Otherwise, you will failed to push refs to dest repo.
              fetch-depth: 0
              ref: refs/heads/${{ github.head_ref }} # Or: ${{ github.event.pull_request.head.ref }}
          - uses: actions/download-artifact@v2
             name: MyArtifact
          - name: Commit files
            run: |
              git config --local core.autocrlf false
              git config --local user.email $git_email
              git config --local user.name "${{ github.actor }}"
              git add . && git add --renormalize .
              git pull origin "${{ github.ref }}" --autostash --rebase -Xours
              git commit -am "${{ github.workflow }}"
            env:
              git_email: "${{ github.actor }}@users.noreply.github.com"
          - name: Push changes (not PR)
            if: github.event_name != 'pull_request'
            uses: ad-m/github-push-action@master
            with:
              branch: ${{ github.ref }}
              github_token: ${{ secrets.GITHUB_TOKEN }}
          - name: Push changes (PR)
            if: github.event_name == 'pull_request'
            uses: ad-m/github-push-action@master
            with:
              branch: refs/heads/${{ github.head_ref }}
              github_token: ${{ secrets.GITHUB_TOKEN }}
    

    Despite I'm checking out the right HEAD, I see some extra merge commits:

    image

  10. kenorb commented on Jul 13, 2020

    @kenorb

    Here are more details based on the build 866142019.

    I'm pushing my changes using ad-m/github-push-action@master as per:

     Push changes (PR) >
        directory: .
    Run ad-m/github-push-action@master
      with:
        branch: refs/heads/v1.079-dev
        github_token: ***
        directory: .
    Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
    Push to branch refs/heads/v1.079-dev
    To https://github.com/EA31337/EA31337.git
       7173d15..7efcedf  HEAD -> v1.079-dev
    

    So my HEAD changed from 7173d15 to 7efcedf (which is clearly visible above), however the checkout action (I assume) have added extra merge commit BETWEEN them, so my list of 3 last commits (instead of 2) looks like:

    1. "My triggering commit" SHA:7173d15
    2. "Merge 7173d15 into e24c723" SHA:8b7e516 (unwanted merge commit appearing out of blue)
    3. "Pushed action's commit" SHA:7efcedf

    Where e24c723 is origin/master merge commit, whereas I've requested to checkout PR HEAD (ref: refs/heads/${{ github.head_ref }}).

  11. 23 remaining items

  12. MoSattler commented on Aug 6, 2020

    @MoSattler

    It still does not work for me.

    name: CI
    
    on:
      push:
        branches: [master]
      pull_request:
        branches: [master]
    
    jobs:
      test:
        runs-on: ubuntu-latest
    
        steps:
          - uses: actions/checkout@v2
          - uses: actions/setup-node@v1
            with:
              node-version: 12.18.3
    
          - name: install dependencies
            run: npm ci
    
          - name: test
            run: npm run test:coverage
    
          - name: Upload coverage to Codecov
            uses: codecov/codecov-action@v1
            with:
              token: ${{ secrets.CODECOV_TOKEN }}
              fail_ci_if_error: true

    I had to change the checkout to v1 for codecov to report properly

  13. added 2 commits that reference this issue on Aug 19, 2020
  14. yurishkuro commented on Feb 26, 2021

    @yurishkuro

    @andymckay it would be good to update this issue with the exact version number of checkout@v2 where the issue was fixed.

  15. Mubelotix commented on Jan 27, 2022

    @Mubelotix

    Please let us know if you see this re-occuring.

    @andymckay This is re-occuring. My whole CI is completely broken and corrupted. Help

    Edit: I was wrong it was another issue

  16. andymckay commented on Jan 28, 2022

    @andymckay
    Contributor

    @Mubelotix I would recommend you contact customer support here: https://support.github.com/

    Or you can open a new issue on this repository with as much information as you've got so the team can take a look.

  17. added 2 commits that reference this issue on Feb 4, 2022
    7f41583
    f50e6ee
  18. added a commit that references this issue on Dec 27, 2025
    a5bc04a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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