@@ -234,23 +234,47 @@ jobs:
234234 project-path : OneSignalExample
235235 args : -quit -batchmode -nographics -buildTarget Android -executeMethod OneSignalSDK.OneSignalPackagePublisher.ExportUnityPackage
236236
237+ # get the release notes from the PR generated by the shared action
238+ - name : Get PR release notes
239+ id : notes
240+ env :
241+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
242+ run : |
243+ release_notes=$(gh pr view "${{ github.event.pull_request.number }}" --json body -q '.body')
244+
245+ cleaned_notes=$(echo "$release_notes" \
246+ | awk '/^Update/{found=1} found' \
247+ | sed '/^- - -$/d' \
248+ | sed '/^[[:space:]]*$/d')
249+
250+ echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
251+ echo "$cleaned_notes" >> $GITHUB_ENV
252+ echo "EOF" >> $GITHUB_ENV
253+
254+ - name : Update CHANGELOG.md
255+ run : |
256+ echo "Inserting release notes for ${{ inputs.unity_version }}..."
257+ changelog_path="OneSignalExample/Assets/OneSignal/CHANGELOG.md"
258+
259+ # Inject release notes under the Unreleased section
260+ awk -v ver="${{ inputs.unity_version }}" \
261+ -v notes="$RELEASE_NOTES" \
262+ 'BEGIN { printed=0 }
263+ /^## \[Unreleased\]/ {
264+ print $0;
265+ print "## [" ver "]\n### Changed";
266+ print notes "\n";
267+ printed=1;
268+ next
269+ }
270+ { print $0 }' "$changelog_path" > "${changelog_path}.tmp" && mv "${changelog_path}.tmp" "$changelog_path"
271+
237272 - name : Commit Release
238273 run : |
239274 git add .
240275 git commit -m "Release ${{ inputs.unity_version }}"
241276 git push
242277
243- - name : Debug — list Unity package files
244- run : |
245- echo "Current working directory:"
246- pwd
247- echo ""
248- echo "List of all files under OneSignalExample:"
249- ls -Rlh OneSignalExample || true
250- echo ""
251- echo "Searching for .unitypackage files:"
252- find OneSignalExample -type f -name "*.unitypackage" -print
253-
254278 - name : Draft Release
255279 env :
256280 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments