Skip to content

Commit fc98bee

Browse files
TPT-4298: Added PR title checking workflow and clean up release notes workflow (#92)
* Added PR title checking workflow and clean up release notes * Bumped actions/github-script from v7 to v8
1 parent 2c63043 commit fc98bee

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Clean Release Notes
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
clean-release-notes:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
13+
steps:
14+
- name: Remove ticket prefixes from release notes
15+
uses: actions/github-script@v8
16+
with:
17+
script: |
18+
const release = context.payload.release;
19+
20+
let body = release.body;
21+
22+
if (!body) {
23+
console.log("Release body empty, nothing to clean.");
24+
return;
25+
}
26+
27+
// Remove ticket prefixes like "TPT-1234: " or "TPT-1234:"
28+
body = body.replace(/TPT-\d+:\s*/g, '');
29+
30+
await github.rest.repos.updateRelease({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
release_id: release.id,
34+
body: body
35+
});
36+
37+
console.log("Release notes cleaned.");
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 'Validate PR Title'
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
validate-pr-title:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
steps:
12+
# Enforce TPT-1234: prefix on PR titles, with the following exemptions:
13+
# - PRs labeled 'dependencies' (e.g. Dependabot PRs)
14+
# - PRs labeled 'hotfix' (urgent fixes that may not have a ticket)
15+
# - PRs labeled 'community-contribution' (external contributors without TPT tickets)
16+
# - PRs labeled 'ignore-for-release' (release PRs that don't need a ticket prefix)
17+
- name: Validate PR Title
18+
if: github.event_name == 'pull_request'
19+
uses: amannn/action-semantic-pull-request@v6
20+
with:
21+
types: |
22+
TPT-\d+
23+
requireScope: false
24+
# Override the default header pattern to allow hyphens and digits in the type
25+
# (e.g. "TPT-4298: Description"). The default pattern only matches word
26+
# characters (\w) which excludes hyphens.
27+
headerPattern: '^([\w-]+):\s?(.*)$'
28+
headerPatternCorrespondence: type, subject
29+
ignoreLabels: |
30+
dependencies
31+
hotfix
32+
community-contribution
33+
ignore-for-release
34+
env:
35+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)