Skip to content

Commit 699ea59

Browse files
nattb8claude
andcommitted
fix(release): label audience PRs by changed paths, filter changelog by package
Add a github-script step to label-pr.yml that detects Audience package changes (src/Packages/Audience/**) and applies audience-specific labels (audience-feature, audience-fix, etc.) using branch prefix for sub-type. Split the changelog builder in release.yml into audience/passport variants so each release only shows PRs with its own label set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d9c4653 commit 699ea59

2 files changed

Lines changed: 68 additions & 3 deletions

File tree

.github/workflows/label-pr.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,31 @@ jobs:
1919
with:
2020
repo-token: ${{ secrets.GITHUB_TOKEN }}
2121
configuration-path: .github/pr-labeler/config.yml
22+
23+
- uses: actions/github-script@v6
24+
with:
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
script: |
27+
const files = await github.rest.pulls.listFiles({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
pull_number: context.payload.pull_request.number,
31+
})
32+
const isAudience = files.data.some(f =>
33+
f.filename.startsWith('src/Packages/Audience/')
34+
)
35+
if (!isAudience) return
36+
37+
const branch = context.payload.pull_request.head.ref
38+
let label = 'audience-chore'
39+
if (branch.startsWith('feat/')) label = 'audience-feature'
40+
else if (branch.startsWith('fix/')) label = 'audience-fix'
41+
else if (branch.startsWith('perf/')) label = 'audience-performance'
42+
else if (branch.startsWith('docs/')) label = 'audience-docs'
43+
44+
await github.rest.issues.addLabels({
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
issue_number: context.payload.pull_request.number,
48+
labels: [label],
49+
})

.github/workflows/release.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,45 @@ jobs:
4141
- name: Pull LFS
4242
run: git lfs pull
4343

44-
- name: Build Changelog
45-
id: github_release
44+
- name: Build Changelog (Audience)
45+
id: github_release_audience
46+
if: env.IS_AUDIENCE == 'true'
47+
uses: mikepenz/release-changelog-builder-action@v3
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
fromTag: ${{ env.PREV_TAG }}
52+
toTag: ${{ env.LATEST_TAG }}
53+
configurationJson: |
54+
{
55+
"pr_template": "- #{{TITLE}} (##{{NUMBER}})",
56+
"categories": [
57+
{
58+
"title": "## Features",
59+
"labels": ["audience-feature"]
60+
},
61+
{
62+
"title": "## Fixes",
63+
"labels": ["audience-fix"]
64+
},
65+
{
66+
"title": "## Performance",
67+
"labels": ["audience-performance"]
68+
},
69+
{
70+
"title": "## Documentation",
71+
"labels": ["audience-docs"]
72+
},
73+
{
74+
"title": "## Chores",
75+
"labels": ["audience-chore"]
76+
}
77+
]
78+
}
79+
80+
- name: Build Changelog (Passport)
81+
id: github_release_passport
82+
if: env.IS_AUDIENCE != 'true'
4683
uses: mikepenz/release-changelog-builder-action@v3
4784
env:
4885
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -108,7 +145,7 @@ jobs:
108145
tag_name: ${{ env.LATEST_TAG }}
109146
release_name: ${{ env.LATEST_TAG }}
110147
body: |
111-
${{steps.github_release.outputs.changelog}}
148+
${{steps.github_release_audience.outputs.changelog}}${{steps.github_release_passport.outputs.changelog}}
112149
113150
${{ env.RELEASE_BODY_SUFFIX }}
114151
draft: false

0 commit comments

Comments
 (0)