Skip to content

Commit fe684f3

Browse files
committed
include release note to CHANGELOG
1 parent 4dd7698 commit fe684f3

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.github/workflows/create-release-pr.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,33 @@ jobs:
128128
android_from: ${{ needs.update-version.outputs.android_from }}
129129
android_to: ${{ inputs.android_version }}
130130
ios_from: ${{ needs.update-version.outputs.ios_from }}
131-
ios_to: ${{ inputs.ios_version }}
131+
ios_to: ${{ inputs.ios_version }}
132+
133+
update-changelog:
134+
needs: [create-pr]
135+
runs-on: ubuntu-latest
136+
steps:
137+
- name: Checkout
138+
uses: actions/checkout@v5
139+
with:
140+
ref: ${{ needs.prep.outputs.release_branch }}
141+
142+
- name: Get PR release notes
143+
id: notes
144+
env:
145+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146+
run: |
147+
sudo apt-get update && sudo apt-get install -y gh || true
148+
PR_NUMBER=$(gh pr list --head "${{ needs.prep.outputs.release_branch }}" --json number -q '.[0].number' || echo "")
149+
if [ -z "$PR_NUMBER" ]; then echo "RELEASE_NOTES=" >> $GITHUB_ENV; exit 0; fi
150+
cleaned_notes=$(gh pr view "$PR_NUMBER" --json body -q '.body' | awk 'BEGIN{found=0} /^- Update/{found=1} /^<!-- Reviewable:start -->/{found=0;next} found' | sed '/^- - -$/d' | sed '/^[[:space:]]*$/d')
151+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
152+
echo "$cleaned_notes" >> $GITHUB_ENV
153+
echo "EOF" >> $GITHUB_ENV
154+
155+
- name: Update CHANGELOG.md
156+
run: |
157+
awk -v ver="${{ inputs.unity_version }}" -v notes="$RELEASE_NOTES" \
158+
'/^## \[Unreleased\]/ { print $0; print "## [" ver "]\n### Changed"; print notes "\n"; next } { print $0 }' \
159+
OneSignalExample/Assets/OneSignal/CHANGELOG.md > /tmp/changelog.tmp && mv /tmp/changelog.tmp OneSignalExample/Assets/OneSignal/CHANGELOG.md
160+
git add . && git commit -m "Update CHANGELOG.md for ${{ inputs.unity_version }}" && git push

0 commit comments

Comments
 (0)