Repository navigation
ci: check PR titles under the gate - #373
Conversation
Add the title job (PR title, shared pr-title action pinned to the v1.0.0 commit) to ci.yml and to the needs of the gate, which allows it to be skipped. Run on edited pull requests, with a concurrency group that keeps title-unchanged edits from cancelling the commit's run, as in cloud-components. Mention the check in the contributing guide. Closes #371 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR adds a permissions-free, commit-pinned PR title validation job to CI, includes it in the required gate with explicit skip rules for pushes and Dependabot, and updates event/concurrency handling so title edits are rechecked without stale gate results. Workflow tests and contributor documentation are updated accordingly. Sequence diagram for PR title validation and CI gatesequenceDiagram
actor Contributor
participant GitHub
participant CI
participant PRTitle as PR title action
participant Gate as CI passed
Contributor->>GitHub: edit pull request title
GitHub->>CI: pull_request edited
CI->>PRTitle: Check PR title
PRTitle-->>CI: validation result
CI->>Gate: needs includes title
Gate->>Gate: gate action needs
Gate-->>GitHub: required check result
Flow diagram for CI title job skip rulesflowchart TD
Event[Pull request or push event] --> IsPR{pull_request event?}
IsPR -->|No| SkipPush[Skip title job]
IsPR -->|Yes| Dependabot{Dependabot PR?}
Dependabot -->|No| Validate[Run PR title action]
Dependabot -->|Yes| EditedByOther{Title edited by someone else?}
EditedByOther -->|Yes| Validate
EditedByOther -->|No| SkipBot[Skip title job]
Validate --> Gate[CI passed gate]
SkipPush --> Gate
SkipBot --> Gate
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #373 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 2234 2234
=========================================
Hits 2234 2234 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mypy rejects the lookup of the key that PyYAML parses `on` to (True). Look it up by its string form. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/ci.yml" line_range="65-66" />
<code_context>
+ if: >-
+ github.event_name == 'pull_request' && (
+ github.event.pull_request.user.login != 'dependabot[bot]' ||
+ github.event.changes.title &&
+ github.event.sender.login != 'dependabot[bot]')
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
</code_context>
<issue_to_address>
**Invalid Dependabot titles bypass the gate**
When a human changes a Dependabot PR title to an invalid value and Dependabot later synchronizes, reopens, or sends a non-title edit, `job.if` requires `github.event.changes.title` for the bot event, so the `title` job is skipped and the gate's unconditional `title` allowance lets `CI passed` succeed with the invalid current title.
Run the title check for later Dependabot events as well, so the gate cannot pass without checking the current title.
Also at `.github/workflows/ci.yml:605`.
</issue_to_address>
### Comment 2
<location path=".github/workflows/ci.yml" line_range="48-49" />
<code_context>
+ group: >-
+ ${{ github.workflow }}-${{
+ github.event_name == 'push' && github.sha ||
+ github.event.action == 'edited' && !github.event.changes.title &&
+ format('{0}-edited', github.ref) ||
+ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
</code_context>
<issue_to_address>
**Older edit runs report success**
When a title-free PR edit starts with a valid title, then the title changes to an invalid value while that run is still active and the title-check run fails, the title-free edit gets a separate concurrency group, so it is not canceled by the title edit; its run checks the earlier valid title and can report `CI passed` for the same commit after the current title check fails.
Put title-free edit runs and title-edit runs for the same PR in the same concurrency group so the title edit cancels the earlier run.
</issue_to_address>
### Comment 3
<location path=".github/workflows/ci.yml" line_range="45-50" />
<code_context>
+# the run for the pull request's commit
concurrency:
- group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.ref }}
+ group: >-
+ ${{ github.workflow }}-${{
+ github.event_name == 'push' && github.sha ||
+ github.event.action == 'edited' && !github.event.changes.title &&
+ format('{0}-edited', github.ref) ||
+ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
</code_context>
<issue_to_address>
**Stale title events pass the gate**
When two title edits arrive out of order, with an older event carrying a valid title starting after a newer event carrying an invalid title, the concurrency group cancels the currently running check when an older title-edit event starts later, and the title action can validate that event’s stale title. The gate can then pass for the unchanged commit even though the current PR title is invalid.
Before reporting success, validate the current PR title or otherwise ensure a run cannot pass using a superseded title.
</issue_to_address>Linked issues
#371 ci: check PR titles under the gate · 7 of 7 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Add the title job using the shared pr-title action pinned to the latest release. |
✅ Met | The PR title job uses the shared action pinned to a commit labeled v1.0.0. |
| 2 | Add title to the CI passed gate's needs and allow it to be skipped. |
✅ Met | The gate needs title and includes it in allow-skipped. |
| 3 | Run the workflow when a pull request is edited. | ✅ Met | The pull_request event includes edited. |
| 4 | Use a separate concurrency group for edits that do not change the title. | ✅ Met | Title-unchanged edits use a group suffixed with -edited, separate from the pull request's commit run. |
| 5 | Skip the title job on pushes and for Dependabot, unless someone else edits the title. | ✅ Met | The job condition restricts it to pull requests and skips Dependabot unless the title changed and the sender is not Dependabot. |
| 6 | Set permissions: {} for the title job. |
✅ Met | |
| 7 | Mention the title check in the contributing or development docs. | ✅ Met | The contributing page says CI checks the PR title and rechecks it after edits. |
Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: .github/workflows/ci.yml:66, .github/workflows/ci.yml:49, .github/workflows/ci.yml:50
Summary
Adds the
titlejob ("PR title", sharedpr-titleaction pinned to the v1.0.0 commit) toci.ymland to theneedsof the gateCI passed, following cloud-components'ci.yml:pull_requestalso onedited, the concurrency group for edits that don't change the title, skipped on pushes and for Dependabot (unless someone else edits the title),permissions: {}. The gate'sallow-skippedalways allowstitle(andpush publishas before wherePUBLISHis "false").tests/test_workflows.pyfollows (gate expectation, newtest_title_job). The contributing page mentions the check in one line.Light lane: CI change without secrets, permissions or the release workflow; I reviewed the diff myself.
Closes #371
Part of elixir-cloud-aai/.github#49.
Verification
uv run --no-project --with pytest --with pyyaml --with packaging python -m pytest tests/test_workflows.py --noconftest: 23 passed.PR titleandCI passedpassed in the run for the final commit (run 41276649904); the first run failed in mypy on the new test, fixed in the second commit..Declined review findings
None (light lane).
Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Require valid pull request titles as part of the CI gate and recheck them whenever pull requests are edited.
New Features:
Enhancements:
CI:
Documentation:
Tests: