Currents Documentation
Currents.devGitHubChangelog
  • Getting Started
    • What is Currents?
    • Playwright
      • Playwright: Quick Start
      • Troubleshooting Playwright
    • Cypress
      • Your First Cypress Run
      • Integrating with Cypress
        • Compatibility
        • Alternative Cypress Binaries
      • Troubleshooting Cypress
    • Jest
      • Your First Jest Run
      • Detox + Jest
      • Troubleshooting Jest
    • Others
    • CI Setup
      • GitHub Actions
        • Cypress - GitHub Actions
        • Playwright - GitHub Actions
        • Jest - GitHub Actions
        • Node.js - GitHub Actions
        • Commit data for GitHub Actions
        • Custom Docker runners
        • Named Runners
      • GitLab
        • Cypress - GitLab CI/CD
        • Playwright - GitLab CI/CD
        • Custom Docker runners
      • Jenkins
        • Cypress - Jenkins
        • Playwright - Jenkins
      • CircleCI
        • Cypress - CircleCI
        • Playwright - CircleCI
      • Bitbucket
        • Cypress - Bitbucket Pipelines
      • Azure DevOps
        • Cypress - Azure DevOps
        • Playwright - Azure DevOps
      • AWS Code Build
        • Cypress - AWS Code Build
        • Playwright - AWS Code Build
      • NX
        • Playwright - NX
        • Cypress - NX
  • Guides
    • Record Key
    • CI Build ID
    • Reporting
      • Reporting Strategy
      • Reporting in CI
      • Step-Level Reporting
    • CI Optimization
      • Playwright Parallelization
      • Orchestration Setup
      • Fully Parallel Mode
      • Re-run Only Failed Tests
      • Cloud Spot Instances
      • Failing Fast
      • Load Balancing
    • Code Coverage
      • Code Coverage for Playwright
      • Code Coverage for Cypress
    • Currents Actions
      • Setup Currents Actions
      • Using Currents Actions
      • Reference
        • Conditions
        • Actions
    • Playwright Component Testing
    • Playwright Visual Testing
    • Playwright Annotations
    • Playwright Tags
    • MCP Server
  • Dashboard
    • Projects
      • Projects Summary view
      • Project Settings
      • Archive and Unarchive Projects
    • Runs
      • Run Status
      • Run Details
      • Commit Information
      • Tags
      • Run Timeouts
      • Cancelling Runs
      • Deleting Runs
      • Run Progress
    • Tests
      • Spec File Status
      • Test Status
      • Flaky Tests
      • Test History
    • Test Suite Explorer
      • Test Explorer
        • Tests Performance
      • Spec Files Explorer
        • Spec Files Performance
      • Errors Explorer
  • Automated Reports
  • Insights and Analytics
  • Administration
    • Email Domain Based Access
    • SSO SAML2.0
      • SAML2.0 Configuration
      • SCIM User Provisioning
      • IdP-initiated Sessions
      • JumpCloud
        • JumpCloud User provisioning
      • Okta
        • Okta User provisioning
      • Troubleshooting SSO
    • Billing & Usage
  • Billing and Pricing
  • Resources
    • Reporters
      • cypress-cloud
        • Batched Orchestration
        • Migration to Cypress@13
      • @currents/cli
      • @currents/playwright
        • Configuration
        • pwc
        • pwc-p (orchestration)
        • Playwright Fixtures
      • @currents/jest
      • @currents/node-test-reporter
      • @currents/cmd
        • currents api
        • currents upload
        • currents cache
        • currents convert
      • Data Format Reference
    • Integrations
      • GitHub
        • GitHub App
        • GitHub OAuth
      • GitLab
      • Slack
      • Microsoft Teams
      • HTTP Webhooks
      • Bitbucket
    • API
      • Introduction
      • Authentication
      • API Keys
      • Errors
      • Pagination
      • API Resources
        • Instances
        • Runs
        • Projects
        • Spec Files
        • Test Signature
        • Test Results
    • Data Privacy
      • Access to Customer Data
      • Data Retention
      • Cloud Endpoints
    • Support
Powered by GitBook
On this page
  • GitHub Pull Request Title, Issue Link and Branch Name
  • Temporary commit in GitHub Pull Requests

Was this helpful?

  1. Getting Started
  2. CI Setup
  3. GitHub Actions

Commit data for GitHub Actions

How to get correct git commit information when using GitHub Actions

PreviousNode.js - GitHub ActionsNextCustom Docker runners

Last updated 5 months ago

Was this helpful?

GitHub Pull Request Title, Issue Link and Branch Name

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 better handle git information 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 will display a direct link to GitHub Pull Request issue

Temporary commit in GitHub Pull Requests

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:

Merge de7282540ac30ee4e32a0b1fede4f6391b4cc321 into fa58941d8a807b83ec5a3e5bfb83418ce12173c7

Also, the branch name becomes refs/pull/12/merge instead of the expected branch name. Why is that happening?

It changes the behaviour of @actions/checkout - it creates a new merge commit, which is created from merging the base to the head.

Specifically:

  • 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

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.

To change the default behaviour and checkout the triggering commit, use the following @actions/checkout configuration

- uses: actions/checkout@v2
  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.

That happens when your GitHub Actions workflow is triggered by .

Read more about (by frontside.com).

pull_request
GitHub Actions and pull_request
Capturing GitHub PR data