For the complete documentation index, see llms.txt. This page is also available as Markdown.

Commit data for GitHub Actions

How to get correct git commit information when using GitHub Actions

Update Jan 30, 2024

@currents/playwright@0.12.0 and cypress-cloud@1.10.0 automatically detect Pull Request information when running in GitHub Actions.

The recent (Jan 30, 2024) releases of @currents/playwright@0.12.0 and cypress-cloud@1.10.0 handles git information better when running in GitHub Actions triggered by `pull_request` trigger.

  • PR title becomes Run Title (instead of a generic message PR #XX)

  • Effective Branch becomes the PR HEAD branch name - allowing more meaningful usage in analytics and notification filters

  • UI displays a direct link to GitHub Pull Request issue

Capturing GitHub PR data

Merge commit in pull request runs

@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.

On 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:

The reporter detects the merge commit and records the last commit of the pull request instead: its SHA, message, author and timestamp.

With the default actions/checkout settings, the clone has only the merge commit, so the reporter fetches the pull request commit:

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 for other CI providers.

Earlier versions and Cypress

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:

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.

Last updated

Was this helpful?