Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/clean-release-notes.yml
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, '');
Comment on lines +27 to +28
Copy link

Copilot AI Apr 1, 2026

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*/g removes 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.

Suggested change
// Remove ticket prefixes like "TPT-1234: " or "TPT-1234:"
body = body.replace(/TPT-\d+:\s*/g, '');
// Remove ticket prefixes like "TPT-1234: " or "TPT-1234:" only at the start of lines (optionally after list markers)
body = body.replace(/^(\s*[-*]\s*)?TPT-\d+:\s*/gm, '');

Copilot uses AI. Check for mistakes.

await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
body: body
});

console.log("Release notes cleaned.");
35 changes: 35 additions & 0 deletions .github/workflows/validate-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Validate PR Title'
on:
pull_request:
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on: pull_request without explicit activity types does not include the edited event. That means a PR title can be changed after the initial check and this workflow won’t rerun automatically, leaving a stale green check. Add on.pull_request.types to include at least edited (and typically opened, reopened, synchronize) so title edits are revalidated.

Suggested change
pull_request:
pull_request:
types: [opened, reopened, synchronize, edited]

Copilot uses AI. Check for mistakes.

jobs:
validate-pr-title:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
# Enforce TPT-1234: prefix on PR titles, with the following exemptions:
# - PRs labeled 'dependencies' (e.g. Dependabot PRs)
# - PRs labeled 'hotfix' (urgent fixes that may not have a ticket)
# - PRs labeled 'community-contribution' (external contributors without TPT tickets)
# - PRs labeled 'ignore-for-release' (release PRs that don't need a ticket prefix)
- name: Validate PR Title
if: github.event_name == 'pull_request'
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 }}
Comment on lines +19 to +35
Copy link

Copilot AI Apr 1, 2026

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Loading