Auto-merge trusted contributors #27
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-merge trusted contributors | |
| on: | |
| workflow_run: | |
| workflows: ["Lint and Test Charts"] | |
| types: [completed] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| auto-merge: | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event.workflow_run.conclusion == 'success' && | |
| github.event.workflow_run.event == 'pull_request' && | |
| contains(fromJSON('["makavity", "mit-73"]'), github.event.workflow_run.actor.login) | |
| steps: | |
| - name: Enable auto-merge | |
| run: | | |
| PR_NUMBER="${{ github.event.workflow_run.pull_requests[0].number }}" | |
| if [ -z "$PR_NUMBER" ] || [ "$PR_NUMBER" = "0" ]; then | |
| echo "No PR found in workflow_run payload, skipping" | |
| exit 0 | |
| fi | |
| gh pr merge --auto --squash "$PR_NUMBER" --repo "${{ github.repository }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |