@@ -159,6 +159,41 @@ jobs:
159159 run : ruff format --check --diff
160160 - name : Run ruff check
161161 run : ruff check tidy3d
162+
163+ lint-commit-messages :
164+ needs : determine-test-scope
165+ runs-on : ubuntu-latest
166+ name : veryify-commit-linting
167+ steps :
168+ - name : Check out source code
169+ uses : actions/checkout@v4
170+ with :
171+ fetch-depth : 0 # fetch all commits in the PR
172+
173+ - name : Setup node
174+ uses : actions/setup-node@v4
175+ with :
176+ node-version : lts/*
177+
178+ - name : Install commitlint
179+ run : npm install -D @commitlint/cli @commitlint/config-conventional
180+
181+ - name : Print versions
182+ run : |
183+ git --version
184+ node --version
185+ npm --version
186+ npx commitlint --version
187+
188+ - name : Check commit messages (merge_group)
189+ if : github.event_name == 'merge_group'
190+ run : |
191+ # For merge groups, check the commits being merged
192+ npx commitlint --from ${{ github.event.merge_group.base_sha }} --to ${{ github.event.merge_group.head_sha }} --verbose || {
193+ echo "Commit message linting failed; please follow the conventional commits format at https://www.conventionalcommits.org/"
194+ exit 1
195+ }
196+
162197
163198 verify-schema-change :
164199 name : verify-schema-change
@@ -480,7 +515,7 @@ jobs:
480515 (( needs.determine-test-scope.outputs.pr_approval_state == 'true' ) &&
481516 ( needs.determine-test-scope.outputs.local_tests == 'true' ) ||
482517 ( needs.determine-test-scope.outputs.remote_tests == 'true' ))
483- needs : [local-tests, remote-tests, lint, verify-schema-change]
518+ needs : [local-tests, remote-tests, lint, verify-schema-change, lint-commit-messages ]
484519 runs-on : ubuntu-latest
485520 steps :
486521 - name : check-passing-remote-tests
@@ -502,5 +537,8 @@ jobs:
502537 elif [[ "${{ needs.determine-test-scope.outputs.pr_approval_state }}" == 'true' && github.event.pull_request ]]; then
503538 echo "❌ PR requires approval."
504539 exit 1
540+ elif [[ github.event_name == 'merge_group' && "${{ needs.lint-commit-messages.result }}" != 'success' ]]; then
541+ echo "❌ Linting of commit messages failed or was skipped."
542+ exit 1
505543 fi
506544 echo "✅ All required test jobs passed!"
0 commit comments