Skip to content

Commit 56d7e83

Browse files
committed
Extract purpose from PR description for release notes in GitHub Actions workflow
1 parent 4f8405f commit 56d7e83

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/create-tag-on-merge.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ jobs:
4040
if (prs?.length > 0) {
4141
const pull_number = prs[0].number;
4242
const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number });
43+
44+
// Extract only the Purpose section from PR description
45+
let releaseNote = 'No description provided';
46+
if (pr.body) {
47+
const purposeMatch = pr.body.match(/Purpose:\s*(.+?)(?:\n|Main changes:|$)/s);
48+
49+
if (purposeMatch) {
50+
releaseNote = purposeMatch[1].trim();
51+
}
52+
}
53+
54+
core.setOutput('pr-title', pr.title);
55+
core.setOutput('release-note', releaseNote);
56+
core.setOutput('pr-number', pr.number);
57+
4358
return pr.labels.some(label => label.name.includes('auto-deploy'));
4459
}
4560
return false;
@@ -49,6 +64,8 @@ jobs:
4964
env:
5065
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5166
run: |
52-
gh release create $NEW_TAG --generate-notes
67+
RELEASE_NOTE="${{ steps.should-deploy.outputs.release-note }}"
68+
69+
gh release create $NEW_TAG --notes "$RELEASE_NOTE"
5370
git checkout $NEW_TAG
5471
npm run update-v2-tag

0 commit comments

Comments
 (0)