|
| 1 | +name: Dependabot Automation |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, reopened, synchronize] |
| 6 | + |
| 7 | +permissions: |
| 8 | + pull-requests: write |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + dependabot: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'zoola969/cachium' |
| 15 | + steps: |
| 16 | + - name: Dependabot metadata |
| 17 | + id: metadata |
| 18 | + uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 |
| 19 | + with: |
| 20 | + github-token: "${{ secrets.GITHUB_TOKEN }}" |
| 21 | + |
| 22 | + - name: Approve a PR |
| 23 | + if: >- |
| 24 | + steps.metadata.outputs.update-type == 'version-update:semver-patch' || |
| 25 | + steps.metadata.outputs.update-type == 'version-update:semver-minor' || |
| 26 | + steps.metadata.outputs.update-type == 'security-update:semver-patch' || |
| 27 | + steps.metadata.outputs.update-type == 'security-update:semver-minor' |
| 28 | + run: gh pr review --approve "$PR_URL" |
| 29 | + env: |
| 30 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 31 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + |
| 33 | + - name: Enable auto-merge for Dependabot PRs |
| 34 | + if: >- |
| 35 | + steps.metadata.outputs.update-type == 'version-update:semver-patch' || |
| 36 | + steps.metadata.outputs.update-type == 'version-update:semver-minor' || |
| 37 | + steps.metadata.outputs.update-type == 'security-update:semver-patch' || |
| 38 | + steps.metadata.outputs.update-type == 'security-update:semver-minor' |
| 39 | + run: gh pr merge --auto --squash "$PR_URL" |
| 40 | + env: |
| 41 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 42 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + |
| 44 | + pre-commit-ci: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + if: github.event.pull_request.user.login == 'pre-commit-ci[bot]' && github.repository == 'zoola969/cachium' |
| 47 | + steps: |
| 48 | + - name: Approve pre-commit.ci autoupdate PR |
| 49 | + run: gh pr review --approve "$PR_URL" |
| 50 | + env: |
| 51 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 52 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + |
| 54 | + - name: Enable auto-merge for pre-commit.ci PRs |
| 55 | + run: gh pr merge --auto --squash "$PR_URL" |
| 56 | + env: |
| 57 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 58 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments