-
Notifications
You must be signed in to change notification settings - Fork 30
TPT-4298: Added PR title checking workflow and clean up release notes workflow #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Clean Release Notes | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| clean-release-notes: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Remove ticket prefixes from release notes | ||
| uses: actions/github-script@v8 | ||
| with: | ||
| script: | | ||
| const release = context.payload.release; | ||
|
|
||
| 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 | ||
| }); | ||
|
|
||
| console.log("Release notes cleaned."); | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,35 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'Validate PR Title' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | |
| pull_request: | |
| types: [opened, reopened, synchronize, edited] |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amannn/action-semantic-pull-request treats types as a list of allowed literal types, not a regex. With types: TPT-\d+, titles like TPT-4298: ... will be parsed as type TPT-4298 and won’t match the literal TPT-\d+, causing the check to fail unexpectedly. Consider switching to a simple regex validation step against github.event.pull_request.title, or adjust the action config to validate the Jira pattern via headerPattern without relying on types matching dynamic IDs.
| uses: amannn/action-semantic-pull-request@v6 | |
| with: | |
| types: | | |
| TPT-\d+ | |
| requireScope: false | |
| # 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?(.*)$' | |
| headerPatternCorrespondence: type, subject | |
| ignoreLabels: | | |
| dependencies | |
| hotfix | |
| community-contribution | |
| ignore-for-release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| PR_LABELS: ${{ toJson(github.event.pull_request.labels) }} | |
| run: | | |
| echo "PR title: \"$PR_TITLE\"" | |
| echo "PR labels: $PR_LABELS" | |
| python - << 'PY' | |
| import json | |
| import os | |
| import re | |
| import sys | |
| title = os.environ.get("PR_TITLE", "") | |
| labels_raw = os.environ.get("PR_LABELS", "[]") | |
| try: | |
| labels = json.loads(labels_raw) | |
| except json.JSONDecodeError: | |
| print("::warning::Unable to parse PR labels; proceeding without exemptions.") | |
| labels = [] | |
| exempt_labels = { | |
| "dependencies", | |
| "hotfix", | |
| "community-contribution", | |
| "ignore-for-release", | |
| } | |
| label_names = {label.get("name", "") for label in labels if isinstance(label, dict)} | |
| # Skip validation if any exempting label is present. | |
| if exempt_labels & label_names: | |
| print("Exempting PR from title validation due to labels:", ", ".join(exempt_labels & label_names)) | |
| sys.exit(0) | |
| pattern = re.compile(r"^TPT-\d+:\s?.+") | |
| if not pattern.match(title): | |
| print("::error::PR title must start with 'TPT-<number>:' (e.g., 'TPT-1234: Description').") | |
| sys.exit(1) | |
| print("PR title matches required pattern.") | |
| PY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The replacement regex
/TPT-\d+:\s*/gremoves ticket IDs anywhere in the release body, including mid-sentence references (e.g., “See TPT-1234: for details”), not just leading prefixes on changelog lines. If the intent is only to strip per-entry prefixes, anchor the pattern to line starts (multiline) and optionally to list markers so other references aren’t accidentally altered.