Add workflow to auto-approve bot workflow runs #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto-approve bot workflow runs | ||
|
Check failure on line 1 in .github/workflows/auto-approve-bot-runs.yml
|
||
| on: | ||
| # workflow_run runs in the context of the default branch, | ||
| # so it is not itself subject to the approval gate. | ||
| workflow_run: | ||
| types: [requested] | ||
| permissions: | ||
| actions: write | ||
| jobs: | ||
| approve: | ||
| runs-on: ubuntu-latest | ||
| if: >- | ||
| github.event.workflow_run.conclusion == 'action_required' && | ||
| contains(fromJSON('["github-actions[bot]","dependabot[bot]"]'), github.event.workflow_run.actor.login) | ||
| steps: | ||
| - name: Approve workflow run | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| echo "Approving run ${{ github.event.workflow_run.id }} triggered by ${{ github.event.workflow_run.actor.login }}" | ||
| gh run approve ${{ github.event.workflow_run.id }} --repo ${{ github.repository }} | ||