mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Create PR for changelog instead of direct commit
This commit is contained in:
		
							
								
								
									
										37
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										37
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -305,6 +305,10 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  publish-release:
 | 
					  publish-release:
 | 
				
			||||||
    runs-on: ubuntu-20.04
 | 
					    runs-on: ubuntu-20.04
 | 
				
			||||||
 | 
					    outputs:
 | 
				
			||||||
 | 
					      prerelease: ${{ steps.get_version.outputs.prerelease }}
 | 
				
			||||||
 | 
					      changelog: ${{ steps.create-release.outputs.body }}
 | 
				
			||||||
 | 
					      version: ${{ steps.get_version.outputs.version }}
 | 
				
			||||||
    needs:
 | 
					    needs:
 | 
				
			||||||
      - build-release
 | 
					      - build-release
 | 
				
			||||||
    if: github.ref_type == 'tag' && (startsWith(github.ref_name, 'v') || contains(github.ref_name, '-beta.rc'))
 | 
					    if: github.ref_type == 'tag' && (startsWith(github.ref_name, 'v') || contains(github.ref_name, '-beta.rc'))
 | 
				
			||||||
@@ -348,6 +352,13 @@ jobs:
 | 
				
			|||||||
          asset_path: ./paperless-ngx.tar.xz
 | 
					          asset_path: ./paperless-ngx.tar.xz
 | 
				
			||||||
          asset_name: paperless-ngx-${{ steps.get_version.outputs.version }}.tar.xz
 | 
					          asset_name: paperless-ngx-${{ steps.get_version.outputs.version }}.tar.xz
 | 
				
			||||||
          asset_content_type: application/x-xz
 | 
					          asset_content_type: application/x-xz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  append-changelog:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-20.04
 | 
				
			||||||
 | 
					    needs:
 | 
				
			||||||
 | 
					      - publish-release
 | 
				
			||||||
 | 
					    if: needs.publish-release.outputs.prerelease == 'false'
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Checkout
 | 
					        name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v3
 | 
				
			||||||
@@ -358,11 +369,33 @@ jobs:
 | 
				
			|||||||
        id: append-Changelog
 | 
					        id: append-Changelog
 | 
				
			||||||
        working-directory: docs
 | 
					        working-directory: docs
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          echo -e "# Changelog\n\n${{ steps.create-release.outputs.body }}\n" > changelog-new.md
 | 
					          git branch ${{ needs.publish-release.outputs.version }}-changelog
 | 
				
			||||||
 | 
					          git checkout ${{ needs.publish-release.outputs.version }}-changelog
 | 
				
			||||||
 | 
					          echo -e "# Changelog\n\n${{ needs.publish-release.outputs.changelog }}\n" > changelog-new.md
 | 
				
			||||||
          CURRENT_CHANGELOG=`tail --lines +2 changelog.md`
 | 
					          CURRENT_CHANGELOG=`tail --lines +2 changelog.md`
 | 
				
			||||||
          echo -e "$CURRENT_CHANGELOG" >> changelog-new.md
 | 
					          echo -e "$CURRENT_CHANGELOG" >> changelog-new.md
 | 
				
			||||||
          mv changelog-new.md changelog.md
 | 
					          mv changelog-new.md changelog.md
 | 
				
			||||||
          git config --global user.name "github-actions"
 | 
					          git config --global user.name "github-actions"
 | 
				
			||||||
          git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
 | 
					          git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
 | 
				
			||||||
          git commit -am "Changelog ${{ steps.get_version.outputs.version }} - GHA"
 | 
					          git commit -am "Changelog ${{ steps.get_version.outputs.version }} - GHA"
 | 
				
			||||||
          git push origin HEAD:main
 | 
					          git push origin ${{ needs.publish-release.outputs.version }}-changelog
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Create Pull Request
 | 
				
			||||||
 | 
					        uses: actions/github-script@v6
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          script: |
 | 
				
			||||||
 | 
					            const { repo, owner } = context.repo;
 | 
				
			||||||
 | 
					            const result = await github.rest.pulls.create({
 | 
				
			||||||
 | 
					              title: '[Documentation] Add ${{ needs.publish-release.outputs.version }} changelog',
 | 
				
			||||||
 | 
					              owner,
 | 
				
			||||||
 | 
					              repo,
 | 
				
			||||||
 | 
					              head: '${{ needs.publish-release.outputs.version }}-changelog',
 | 
				
			||||||
 | 
					              base: 'main',
 | 
				
			||||||
 | 
					              body: 'This PR is auto-generated by CI.'
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            github.rest.issues.addLabels({
 | 
				
			||||||
 | 
					              owner,
 | 
				
			||||||
 | 
					              repo,
 | 
				
			||||||
 | 
					              issue_number: result.data.number,
 | 
				
			||||||
 | 
					              labels: ['documentation']
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user