@@ -305,6 +305,10 @@ jobs:
305305
306306 publish-release :
307307 runs-on : ubuntu-20.04
308+ outputs :
309+ prerelease : ${{ steps.get_version.outputs.prerelease }}
310+ changelog : ${{ steps.create-release.outputs.body }}
311+ version : ${{ steps.get_version.outputs.version }}
308312 needs :
309313 - build-release
310314 if : github.ref_type == 'tag' && (startsWith(github.ref_name, 'v') || contains(github.ref_name, '-beta.rc'))
@@ -348,6 +352,13 @@ jobs:
348352 asset_path : ./paperless-ngx.tar.xz
349353 asset_name : paperless-ngx-${{ steps.get_version.outputs.version }}.tar.xz
350354 asset_content_type : application/x-xz
355+
356+ append-changelog :
357+ runs-on : ubuntu-20.04
358+ needs :
359+ - publish-release
360+ if : needs.publish-release.outputs.prerelease == 'false'
361+ steps :
351362 -
352363 name : Checkout
353364 uses : actions/checkout@v3
@@ -358,11 +369,33 @@ jobs:
358369 id : append-Changelog
359370 working-directory : docs
360371 run : |
361- echo -e "# Changelog\n\n${{ steps.create-release.outputs.body }}\n" > changelog-new.md
372+ git branch ${{ needs.publish-release.outputs.version }}-changelog
373+ git checkout ${{ needs.publish-release.outputs.version }}-changelog
374+ echo -e "# Changelog\n\n${{ needs.publish-release.outputs.changelog }}\n" > changelog-new.md
362375 CURRENT_CHANGELOG=`tail --lines +2 changelog.md`
363376 echo -e "$CURRENT_CHANGELOG" >> changelog-new.md
364377 mv changelog-new.md changelog.md
365378 git config --global user.name "github-actions"
366379 git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
367380 git commit -am "Changelog ${{ steps.get_version.outputs.version }} - GHA"
368- git push origin HEAD:main
381+ git push origin ${{ needs.publish-release.outputs.version }}-changelog
382+ -
383+ name : Create Pull Request
384+ uses : actions/github-script@v6
385+ with :
386+ script : |
387+ const { repo, owner } = context.repo;
388+ const result = await github.rest.pulls.create({
389+ title: '[Documentation] Add ${{ needs.publish-release.outputs.version }} changelog',
390+ owner,
391+ repo,
392+ head: '${{ needs.publish-release.outputs.version }}-changelog',
393+ base: 'main',
394+ body: 'This PR is auto-generated by CI.'
395+ });
396+ github.rest.issues.addLabels({
397+ owner,
398+ repo,
399+ issue_number: result.data.number,
400+ labels: ['documentation']
401+ });
0 commit comments