TPT-4298: Added PR title checking to lint workflow and clean up release notes workflow#138
Conversation
There was a problem hiding this comment.
Pull request overview
Adds automation to enforce Jira-style PR titles and to clean Jira ticket prefixes out of published release notes.
Changes:
- Add a CI step to validate PR titles follow a
TPT-1234:-style prefix (with label-based exemptions). - Add a new workflow triggered on release publish to strip
TPT-####:prefixes from release notes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/ci.yml | Introduces PR title validation step and scopes job permissions. |
| .github/workflows/clean-release-notes.yml | Adds a release-published workflow that edits release notes to remove TPT-####: prefixes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Override the default header pattern to allow hyphens and digits in the type | ||
| # (e.g. "TPT-4298: Description"). The default pattern only matches word | ||
| # characters (\w) which excludes hyphens. | ||
| headerPattern: '^([\w-]+):\s?(.*)$' |
There was a problem hiding this comment.
headerPattern currently allows any type segment (any [\w-]+) and does not itself enforce the intended TPT-<digits> prefix. This makes the title validation logic harder to reason about and more brittle (it relies on the separate types setting to fully constrain the pattern). Consider encoding the full requirement directly in headerPattern (e.g., only match TPT-\d+ and require a non-empty subject), so a single regex defines the contract.
| # Override the default header pattern to allow hyphens and digits in the type | |
| # (e.g. "TPT-4298: Description"). The default pattern only matches word | |
| # characters (\w) which excludes hyphens. | |
| headerPattern: '^([\w-]+):\s?(.*)$' | |
| # Override the default header pattern to enforce the "TPT-<digits>: Description" | |
| # format (e.g. "TPT-4298: Description") and require a non-empty subject. | |
| headerPattern: '^TPT-(\d+):\s+(.+)$' |
| let body = release.body; | ||
|
|
||
| if (!body) { | ||
| console.log("Release body empty, nothing to clean."); | ||
| return; | ||
| } | ||
|
|
||
| // Remove ticket prefixes like "TPT-1234: " or "TPT-1234:" | ||
| body = body.replace(/TPT-\d+:\s*/g, ''); | ||
|
|
||
| await github.rest.repos.updateRelease({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| release_id: release.id, | ||
| body: body | ||
| }); |
There was a problem hiding this comment.
This workflow always calls repos.updateRelease even when the regex replacement doesn't change the body. Consider comparing the cleaned body to the original and returning early if there are no changes to avoid an unnecessary write to the Releases API (and reduce noise/permission usage).
📝 Description
Added a new step in the lint workflow to fail if the PR title does not begin with "TPT-1234:" (works with and without a space between the colon and description).
Also added a new workflow to run upon release publish to edit the release notes to remove the Jira ticket ID prefixes from patch notes.
✔️ How to Test
To test the PR title enforcement, edit the title of this PR to remove the Jira ticket ID and rerun the lint job. It should fail immediately. Then, add the Jira ticket ID back to the PR title and it should pass.
To test the release note cleanup job, check out this PR locally and merge it into your fork. Then, cut a test release to your fork. Upon generating the release notes, the TPT-**** prefix will still be there. Publish the release and verify that the new workflow is triggered. After it finishes, confirm that the release notes were correctly updated.