diff --git a/.github/workflows/auto-merge-dependabot-prs.yml b/.github/workflows/auto-merge-dependabot-prs.yml deleted file mode 100644 index ad50d1b8..00000000 --- a/.github/workflows/auto-merge-dependabot-prs.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Auto merge dependabot PRs if passed other jobs -on: pull_request - -permissions: - contents: write - pull-requests: write - # checks: read # For private repositories - # actions: read # For private repositories - -jobs: - auto-merge-dependabot-prs: - runs-on: ubuntu-latest - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@v1.3.4 - with: - github-token: '${{ secrets.GITHUB_TOKEN }}' - - uses: actions/checkout@v3 - - name: Wait other jobs are passed or failed - if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}} - uses: kachick/wait-other-jobs@v1 - timeout-minutes: 5 - with: - github-token: '${{ secrets.GITHUB_TOKEN }}' - - name: Auto approve and merge - if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}} - run: gh pr review --approve "$PR_URL" && gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/merge-bot-pr.yml b/.github/workflows/merge-bot-pr.yml new file mode 100644 index 00000000..4b25ee42 --- /dev/null +++ b/.github/workflows/merge-bot-pr.yml @@ -0,0 +1,55 @@ +name: Merge bot PR after CI +on: pull_request + +permissions: + contents: write + pull-requests: write + # checks: read # For private repositories + # actions: read # For private repositories + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1.3.4 + with: + github-token: '${{ secrets.GITHUB_TOKEN }}' + - uses: actions/checkout@v3 + - name: Wait other jobs + if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}} + uses: kachick/wait-other-jobs@v1 + timeout-minutes: 10 + with: + github-token: '${{ secrets.GITHUB_TOKEN }}' + - name: Approve and merge + if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}} + run: gh pr review --approve "$PR_URL" && gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + # Avoid `automerge` renovate official feature. + # It wait longtime to be merged. + # Avoid `platformAutomerge` renovate official feature. + # It requires many changes in GitHub settings. + # - `Allow auto-merge` + # - `Require status checks to pass before merging` and specify the status names + # Changing in all personal repository is annoy task for me. Even if using terrafform, getting mandatory CI names in each repo is too annoy! + renovate: + runs-on: ubuntu-latest + if: ${{ github.actor == 'renovate[bot]' }} + steps: + - uses: actions/checkout@v3 + - name: Wait other jobs + uses: kachick/wait-other-jobs@v1 + timeout-minutes: 10 + with: + github-token: '${{ secrets.GITHUB_TOKEN }}' + - name: Approve and merge + run: gh pr review --approve "$PR_URL" && gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/renovate.json b/renovate.json index 397e5961..d95ef5af 100644 --- a/renovate.json +++ b/renovate.json @@ -6,7 +6,6 @@ "github>kachick/renovate-config-dprint:plugins" ], "labels": ["dependencies", "renovate"], - "automerge": true, "enabledManagers": ["regex"], "packageRules": [ {