diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c0e82c194eae..3e733c06cf6b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -126,6 +126,11 @@ jobs: fi commits: + # Only check commits if we have access to the pull_request context. + # + # Luckily there's no need to lint commit messages in the Merge Queue, because + # changes to the target branch can't change commit messages on the base branch. + if: ${{ github.event.pull_request.number }} runs-on: ubuntu-slim timeout-minutes: 5 steps: diff --git a/ci/github-script/lint-commits.js b/ci/github-script/lint-commits.js index 1824c538b22f..4905517a142e 100644 --- a/ci/github-script/lint-commits.js +++ b/ci/github-script/lint-commits.js @@ -9,8 +9,7 @@ const { classify } = require('../supportedBranches.js') * }} CheckCommitMessagesProps */ async function checkCommitMessages({ github, context, core }) { - // Do not run on merge groups: it'd be much harder, and there is no need - // (changes to the target branch can't change commit messages on the base branch). + // This check should only be run when we have the pull_request context. const pull_number = context.payload.pull_request?.number if (!pull_number) { core.info('This is not a pull request. Skipping checks.')