diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdb62e88..1024e697 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,12 +181,28 @@ jobs: - id: diff run: tools/ci/manifest.sh if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') - - uses: peter-evans/create-pull-request@v5 + - name: Create PR + id: create-pull-request + uses: peter-evans/create-pull-request@v5 with: title: Update manifest body: | - Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request) + Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request). + + This will be auto-merged when CI has passed because this is an auto-generated PR in a defined format and is usually considered no additional review is required. branch: update-manifest token: ${{ secrets.CREATE_PR_TOKEN }} if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' + - name: Enable auto-merge for auto-generated PR + run: gh pr merge --rebase --auto "${PR_NUMBER:?}" + env: + GITHUB_TOKEN: ${{ secrets.CREATE_PR_TOKEN }} + PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }} + if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' && steps.create-pull-request.outputs.pull-request-operation == 'created' + - name: Auto approve for auto-generated PR + run: gh pr review --approve "${PR_NUMBER:?}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }} + if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' && steps.create-pull-request.outputs.pull-request-operation == 'created' - run: git add -N . && git diff --exit-code