Skip to content

check-up-to-dateness

Actions
Check whether a merge group PR is up to date relative to its base branch
v1
Latest
Star (0)

check-up-to-dateness

A GitHub action to check whether a merge group PR is up to date relative to its base branch

Often, GitHub workflows are configured to run the same jobs (e.g., tests) on both pull_request and merge_group events. But if a PR is based on the head of it base branch and the tests pass on the pull_request event, there should be no need to rerun the tests on the merge_group event.

This action can be used to determine whether a PR is based on the head of its base branch and thus whether expensive jobs can be skipped.

Intended use

  1. Add a job like the following to your GitHub workflow:
    check-up-to-dateness:
      outputs:
        is-up-to-date: ${{ steps.main.outputs.is-up-to-date }}
      runs-on: ubuntu-latest
      steps:
        - id: main
          uses: trailofbits/check-up-to-dateness@v1
  2. For any job you want to skip when merging, add the following:
    my-job:
      needs: [check-up-to-dateness]
      if: needs.check-up-to-dateness.outputs.is-up-to-date != 'true'
  3. Under "Settings" -> "Branches" -> "Branch protection rules" -> "Require status checks to pass before merging" -> "Status checks that are required", add the job that you created in step 1, e.g.:
    This final step ensures that if an error occurs in check-up-to-dateness, it will not cause a PR to be merged.

check-up-to-dateness is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Check whether a merge group PR is up to date relative to its base branch
v1
Latest

check-up-to-dateness is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.