add script

This commit is contained in:
Felipe Suero
2023-04-27 13:03:45 -04:00
parent 5cb4007629
commit 413ae51185
2 changed files with 33 additions and 0 deletions
+2
View File
@@ -42,6 +42,8 @@ jobs:
- name: Create PR
run: |
LAST_PR=$(gh pr list --repo ${{ github.repository }} --limit 1 --state merged --search "Release version" --json number | jq -r '.[0].number')
RELEASE_NOTES=$(./scripts/workflows/release-notes.sh $LAST_PR ${{ env.new_version }})
gh pr create \
--title "Release version ${{ inputs.version }}" \
--body "Release version ${{ inputs.version }}" \
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# this script is used to generate release notes for a given release
# first argument is the pull request id for the last release
# the second is the new release number
# the script then grabs every pull request merged since that pull request
# and outputs a string of release notes
echo "Generating release notes for $2"
# get the last release pull request id
LAST_RELEASE_PR=$1
# get the new release number
NEW_RELEASE=$2
#get when the last release was merged
LAST_RELEASE_MERGED_AT=$(gh pr view $LAST_RELEASE_PR --repo actions/languageservices --json mergedAt | jq -r '.mergedAt')
CHANGELIST=$(gh pr list --repo actions/languageservices --base main --state merged --json title --search "merged:>$LAST_RELEASE_MERGED_AT -label:no-release")
# store the release notes in a variable so we can use it later
RELEASE_NOTES="Release $NEW_RELEASE"
UPDATED=$(echo $CHANGELIST | jq -r '.[].title' | while read line; do
echo " - $line \n";
done)
RELEASE_NOTES="$RELEASE_NOTES\n$UPDATED"
echo $RELEASE_NOTES