Skip to content

Commit

Permalink
Setup automerge (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov authored Oct 4, 2021
1 parent 7e8e08e commit 5a3be39
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/remove-automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ jobs:
github.event.workflow.pull_requests[0].auto_merge != null &&
contains(github.event.pull_requests[0].labels.*.name, 'dependencies') }}
steps:
- name: PR number
run: echo "$PR_NUMBER"
env:
PR_NUMBER: ${{ github.event.workflow.pull_requests[0].number }}
- name: Remove automerge
if: ${{ github.event.workflow.conclusion != 'success' }}
run: |
gh pr merge --disable-auto "$PR_NUMBER"
env:
GH_TOKEN: ${{secrets.GH_TOKEN}}
PR_NUMBER: ${{ github.event.workflow.pull_requests[0].number }}
- id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: PR number
run: echo "$PR_NUMBER"
env:
PR_NUMBER: ${{ github.event.workflow.pull_requests[0].number }}
- name: Remove automerge
if: ${{ github.event.workflow.conclusion != 'success' }}
run: |
gh pr merge --disable-auto "$PR_NUMBER"
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
PR_NUMBER: ${{ github.event.workflow.pull_requests[0].number }}
22 changes: 16 additions & 6 deletions .github/workflows/setup-automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,39 @@ jobs:
steps:
- name: Checkout
uses: actions/[email protected]
- id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
github-token: ${{ steps.generate_token.outputs.token }}
- name: Enable auto-merge for bot PRs
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ steps.generate_token.outputs.token }}

other:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Set label for pre-commit
if: ${{ github.actor == 'pre-commit-ci[bot]' }}
run: |
gh pr edit --add-label 'dependencies' "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Set label for all-repos
if: ${{ contains(github.event.pull_request.body,
'Committed via https://github.com/asottile/all-repos') }}
Expand All @@ -52,7 +62,7 @@ jobs:
fi
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Enable auto-merge if labeled
if: ${{ env.AUTOMERGE || (
github.actor != 'dependabot[bot]' &&
Expand All @@ -61,4 +71,4 @@ jobs:
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
GH_TOKEN: ${{ steps.generate_token.outputs.token }}

0 comments on commit 5a3be39

Please sign in to comment.