Skip to content

Commit e865411

Browse files
committed
automatically generate release notes
1 parent 7d092e2 commit e865411

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ jobs:
4141
4242
- name: Create PR
4343
run: |
44+
LAST_PR=$(gh pr list --repo ${{ github.repository }} --limit 1 --state merged --search "Release version" --json number | jq -r '.[0].number')
45+
RELEASE_NOTES=$(./scripts/workflows/release-notes.sh $LAST_PR ${{ env.new_version }})
4446
gh pr create \
45-
--title "Release version ${{ inputs.version }}" \
46-
--body "Release version ${{ inputs.version }}" \
47+
--title "Release version ${{ env.new_version }}" \
48+
--body $RELEASE_NOTES \
4749
--base main \
4850
--head release/${{ inputs.version }}
4951
env:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# this script is used to generate release notes for a given release
3+
# first argument is the pull request id for the last release
4+
# the second is the new release number
5+
6+
# the script then grabs every pull request merged since that pull request
7+
# and outputs a string of release notes
8+
9+
echo "Generating release notes for $2"
10+
11+
# get the last release pull request id
12+
LAST_RELEASE_PR=$1
13+
14+
# get the new release number
15+
NEW_RELEASE=$2
16+
17+
#get when the last release was merged
18+
LAST_RELEASE_MERGED_AT=$(gh pr view $LAST_RELEASE_PR --repo github/vscode-github-actions --json mergedAt | jq -r '.mergedAt')
19+
20+
CHANGELIST=$(gh pr list --repo github/vscode-github-actions --base main --state merged --json title --search "merged:>$LAST_RELEASE_MERGED_AT -label:no-release")
21+
22+
# store the release notes in a variable so we can use it later
23+
24+
RELEASE_NOTES="Release $NEW_RELEASE\n"
25+
26+
UPDATED=$(echo $CHANGELIST | jq -r '.[].title' | while read line; do
27+
echo " - $line \n";
28+
done)
29+
30+
echo $UPDATED

0 commit comments

Comments
 (0)