diff --git a/.github/workflows/licenses-update.yml b/.github/workflows/licenses-update.yml index 991ccafd..03076bfe 100644 --- a/.github/workflows/licenses-update.yml +++ b/.github/workflows/licenses-update.yml @@ -32,17 +32,30 @@ jobs: run: | mv build/reports/dependency-license/index.json src/main/resources/static/3rdPartyLicenses.json - - name: Check for Changes - id: git-check + - name: Set up git config + run: | + git config --global user.email "GitHub Action " + git config --global user.name "GitHub Action " + + - name: Run git add run: | git add src/main/resources/static/3rdPartyLicenses.json - git diff --staged --exit-code || echo "changes=true" >> $GITHUB_ENV + git diff --staged --quiet || echo "changes detected" - - name: Commit and Push Changes - if: env.changes == 'true' - run: | - git config --global user.name 'Stirling-PDF-Bot' - git config --global user.email 'Stirling-PDF-Bot@stirlingtools.com' - git commit -m "Update 3rd Party Licenses" - git push + - name: Create Pull Request + if: env.CHANGES_DETECTED == 'true' + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Update 3rd Party Licenses" + committer: GitHub Action + author: GitHub Action + signoff: true + branch: update-3rd-party-licenses + title: "Update 3rd Party Licenses" + body: | + Auto-generated by [create-pull-request][1] + [1]: https://github.com/peter-evans/create-pull-request + draft: false + delete-branch: true