Skip to content

Checking out within a PR does not create new merge commit when restarting CI jobs #2142

Open
@danieldegrasse

Description

@danieldegrasse

When using actions/checkout@v4 with a config like the following:

- name: Checkout the code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

The initial commit the repo is checked out at corresponds to pull/<pr-no>/merge at the time of the PR synchronization event, as expected. However, if the CI job is manually restarted after another PR is merged to the main branch, the SHA of the commit remains the same as it was prior to main being updated

For an example see: tenstorrent/tt-zephyr-platforms#119

This can be worked around by setting ref: ${{ github.ref }} in the action YAML, like so:

- name: Checkout the code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          ref: ${{ github.ref }}

With this change, restarts of the CI run will always fetch the latest pull/<pr-no>/merge

The impact of this is that when CI is broken on mainline and a fix is merged, PR branches must be updated to trigger a synchronization event (unless the workaround described is used)

Is this expected behavior? IE is the commit used not suppose to update on manual restarts of CI jobs?

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