From 1ba4ba23629607d251a7f208c1efc3d3c2aa98da Mon Sep 17 00:00:00 2001 From: Andrew Goldis Date: Wed, 23 Sep 2026 16:58:54 -0700 Subject: [PATCH 1/4] docs: describe how reporters record the pull request commit instead of the merge commit @currents/playwright 2.5.1 and @currents/cmd 1.11.0 (@currents/commit-info 1.1.0) record the last commit of the pull request when CI checks out a merge commit, so the ref: head.sha checkout is no longer needed to get the commit message. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01LdJrRhBLEH9Uwt97JMGVTR --- dashboard/runs/commit-information.md | 21 ++++++++++++ .../commit-data-for-github-actions.md | 32 ++++++++++--------- .../playwright-github-actions.md | 2 -- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/dashboard/runs/commit-information.md b/dashboard/runs/commit-information.md index 9941de72..a071677f 100644 --- a/dashboard/runs/commit-information.md +++ b/dashboard/runs/commit-information.md @@ -48,6 +48,27 @@ Currents automatically detects PR information, including PR title and the target You can change this behavior in [project-settings.md](../projects/project-settings.md "mention"). +### Merge Commits in Pull Request Runs + +On pull request runs, some CI providers check out a merge commit that they create by merging the pull request into the target branch, for example `Merge into ` in GitHub Actions. `@currents/playwright` `2.5.1` and `@currents/cmd` `1.11.0` record the last commit of the pull request instead. They read its SHA from: + +| CI provider | Pull request commit SHA | +| ------------------------------------ | ------------------------------------------------------------ | +| GitHub Actions | `pull_request.head.sha` in the event file (`GITHUB_EVENT_PATH`) | +| GitLab CI, merged results pipelines | `CI_MERGE_REQUEST_SOURCE_BRANCH_SHA` | +| Azure Pipelines | `SYSTEM_PULLREQUEST_SOURCECOMMITID` | +| Travis CI | `TRAVIS_PULL_REQUEST_SHA` | +| Semaphore | `SEMAPHORE_GIT_PR_SHA` | +| Buildkite | `BUILDKITE_PULL_REQUEST_HEAD_COMMIT` | +| Bitbucket Pipelines | `BITBUCKET_COMMIT` | + +The reporter uses the commit only when it is a parent of the checked-out merge commit. When a shallow clone doesn't have the commit, the reporter fetches it with `git fetch --depth=1 origin `, with a 3 second timeout. If the fetch fails, Currents records the merge commit. + +* Set `CURRENTS_DISABLE_HEAD_COMMIT_FETCH=true` to turn the fetch off. +* Set `COMMIT_INFO_SHA` to record a specific commit. The reporter then skips this step. + +Jenkins sets no variable with the pull request commit, so Currents records the merge commit that Jenkins creates. + ### Overriding Commit Info You can override the commit info by manually setting environment variables: diff --git a/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md b/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md index 098c408d..cd53584e 100644 --- a/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md +++ b/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md @@ -20,36 +20,38 @@ The recent (Jan 30, 2024) releases of `@currents/playwright@0.12.0` and `cypress

Capturing GitHub PR data

-### Temporary commit in GitHub Pull Requests +### Merge commit in pull request runs -Running tests using GitHub Actions can generate confusing git information. For example, instead of the last commit message (or pull request title), one can see something like: +{% hint style="info" %} +`@currents/playwright@2.5.1` and `@currents/cmd@1.11.0` record the last commit of the pull request when GitHub Actions checks out a merge commit. +{% endhint %} + +On [`pull_request`](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request) events, `actions/checkout` checks out a merge commit that GitHub creates by merging the pull request into the base branch. Its message looks like this: ``` Merge de7282540ac30ee4e32a0b1fede4f6391b4cc321 into fa58941d8a807b83ec5a3e5bfb83418ce12173c7 ``` -Also, the branch name becomes `refs/pull/12/merge` instead of the expected branch name. Why is that happening? +The reporter detects the merge commit and records the last commit of the pull request instead: its SHA, message, author and timestamp. -That happens when your GitHub Actions workflow is triggered by [`pull_request`](https://docs.github.com/en/github-ae@latest/actions/using-workflows/events-that-trigger-workflows#pull_request). +With the default `actions/checkout` settings, the clone has only the merge commit, so the reporter fetches the pull request commit: -It changes the behaviour of `@actions/checkout` - it creates a **new merge commit,** which is created from merging the base to the head. +``` +git fetch --depth=1 --no-tags origin +``` -Specifically: +The fetch uses the credentials that `actions/checkout` stores in the clone, and times out after 3 seconds. If it fails, Currents records the merge commit. For example, the fetch fails in a private repository checked out with `persist-credentials: false`. -* it performs `git checkout` to `github.ref` environment variable -* it sets the git `ref` to `refs/remotes/pull/##/merge` -* it sets the commit SHA to an arbitrary value that is different from the commit that triggered the workflow +To turn the fetch off, set `CURRENTS_DISABLE_HEAD_COMMIT_FETCH=true`. See [commit-information.md](../../../dashboard/runs/commit-information.md "mention") for other CI providers. -For example, a developer creates a pull request from the `feat/login` branch to be merged into the `main` branch with the title "_Add new login feature_". When the GitHub Actions workflow is triggered, instead of checking out the `feat/login` branch, the action creates a merge commit. In the GitHub Actions log, the commit message appears as "_Merge de7282540ac30ee4e32a0b1fede4f6391b4cc321 into fa58941d8a807b83ec5a3e5bfb83418ce12173c7_", which is a merge of the `feat/login` branch into the `main` branch. Consequently, the branch name in the CI environment shows as `refs/pull/12/merge`, not the expected `feat/login`. +#### Earlier versions and Cypress -To change the default behaviour and checkout the triggering commit, use the following `@actions/checkout` configuration +`cypress-cloud` and earlier versions of the reporters record the merge commit. To record the last commit of the pull request, check out that commit: ```yaml -- uses: actions/checkout@v2 +- uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} ``` -The workflow will check out the last commit from the **head** branch of the pull request that triggered the workflow. Beware, that this approach might not detect issues that could arise when the pull request is eventually merged into the base branch. If the base branch has been updated since the pull request was created, there might be merge conflicts or integration issues that won't be detected with this configuration. - -Read more about [GitHub Actions and `pull_request`](https://frontside.com/blog/2020-05-26-github-actions-pull_request/) (by frontside.com). +The workflow then tests the last commit of the pull request, not the result of merging it into the base branch. It does not catch conflicts or failures that appear only after the merge. diff --git a/getting-started/ci-setup/github-actions/playwright-github-actions.md b/getting-started/ci-setup/github-actions/playwright-github-actions.md index 133d217c..785113a8 100644 --- a/getting-started/ci-setup/github-actions/playwright-github-actions.md +++ b/getting-started/ci-setup/github-actions/playwright-github-actions.md @@ -25,8 +25,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} # https://github.com/actions/runner-images/issues/6775 - run: | From a9e471c128358fc8a8ad5356ae67b24e1074c559 Mon Sep 17 00:00:00 2001 From: Andrew Goldis Date: Thu, 24 Sep 2026 14:49:20 -0700 Subject: [PATCH 2/4] docs: say which commit fields fall back when the fetch fails Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01LdJrRhBLEH9Uwt97JMGVTR --- .../ci-setup/github-actions/commit-data-for-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md b/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md index cd53584e..796c4b03 100644 --- a/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md +++ b/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md @@ -40,7 +40,7 @@ With the default `actions/checkout` settings, the clone has only the merge commi git fetch --depth=1 --no-tags origin ``` -The fetch uses the credentials that `actions/checkout` stores in the clone, and times out after 3 seconds. If it fails, Currents records the merge commit. For example, the fetch fails in a private repository checked out with `persist-credentials: false`. +The fetch uses the credentials that `actions/checkout` stores in the clone, and times out after 3 seconds. If it fails, the run shows the merge commit's message and author, as with earlier versions. For example, the fetch fails in a private repository checked out with `persist-credentials: false`. The commit SHA and branch still come from the pull request, so PR comments and commit statuses are not affected. To turn the fetch off, set `CURRENTS_DISABLE_HEAD_COMMIT_FETCH=true`. See [commit-information.md](../../../dashboard/runs/commit-information.md "mention") for other CI providers. From 93bb21ff9aa3c20d4cc2a6f19b0456d734f39a1e Mon Sep 17 00:00:00 2001 From: Andrew Goldis Date: Thu, 24 Sep 2026 14:58:48 -0700 Subject: [PATCH 3/4] docs: describe the same fetch fallback on the Commit Information page Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01LdJrRhBLEH9Uwt97JMGVTR --- dashboard/runs/commit-information.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/runs/commit-information.md b/dashboard/runs/commit-information.md index a071677f..162106c7 100644 --- a/dashboard/runs/commit-information.md +++ b/dashboard/runs/commit-information.md @@ -62,7 +62,7 @@ On pull request runs, some CI providers check out a merge commit that they creat | Buildkite | `BUILDKITE_PULL_REQUEST_HEAD_COMMIT` | | Bitbucket Pipelines | `BITBUCKET_COMMIT` | -The reporter uses the commit only when it is a parent of the checked-out merge commit. When a shallow clone doesn't have the commit, the reporter fetches it with `git fetch --depth=1 origin `, with a 3 second timeout. If the fetch fails, Currents records the merge commit. +The reporter uses the commit only when it is a parent of the checked-out merge commit. When a shallow clone doesn't have the commit, the reporter fetches it with `git fetch --depth=1 origin `, with a 3 second timeout. If the fetch fails, the run shows the merge commit's message and author. In GitHub Actions, the commit SHA and branch still come from the pull request. * Set `CURRENTS_DISABLE_HEAD_COMMIT_FETCH=true` to turn the fetch off. * Set `COMMIT_INFO_SHA` to record a specific commit. The reporter then skips this step. From 597119c23d460e5e2b8382ded07589141f16fa34 Mon Sep 17 00:00:00 2001 From: Andrew Goldis Date: Thu, 24 Sep 2026 14:59:01 -0700 Subject: [PATCH 4/4] docs: name the fields earlier reporters take from the merge commit Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01LdJrRhBLEH9Uwt97JMGVTR --- .../ci-setup/github-actions/commit-data-for-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md b/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md index 796c4b03..7963b8bb 100644 --- a/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md +++ b/getting-started/ci-setup/github-actions/commit-data-for-github-actions.md @@ -46,7 +46,7 @@ To turn the fetch off, set `CURRENTS_DISABLE_HEAD_COMMIT_FETCH=true`. See [commi #### Earlier versions and Cypress -`cypress-cloud` and earlier versions of the reporters record the merge commit. To record the last commit of the pull request, check out that commit: +With `cypress-cloud` and earlier versions of the reporters, runs show the merge commit's message and author. To record the last commit of the pull request, check out that commit: ```yaml - uses: actions/checkout@v4