|
| 1 | +# For non-draft changes to Named Release branches: |
| 2 | +# - Check if the user belongs to a maintainers team. |
| 3 | +# - If so, approve the pull request. |
| 4 | +# - Tag community-engineering (for now) and the maintainers team. |
| 5 | +# - Merge the PR when the author comments `@edx-community-bot merge`. |
| 6 | +# Required organization secrets |
| 7 | +# - CC_GITHUB_TOKEN=... |
| 8 | +# - CC_TEAM_CHAMPIONS=org/team-name |
| 9 | +# - CC_TEAM_CONTRIBUTORS_ORG=org |
| 10 | +# - CC_TEAM_CONTRIBUTORS_TEAM=team-name |
| 11 | +--- |
| 12 | +name: automerge BTR open-release PRs |
| 13 | +on: |
| 14 | + issue_comment: |
| 15 | + branches: |
| 16 | + - open-release/* |
| 17 | + types: |
| 18 | + - created |
| 19 | + - edited |
| 20 | + pull_request_target: |
| 21 | + branches: |
| 22 | + - open-release/* |
| 23 | + types: |
| 24 | + - opened |
| 25 | + - edited |
| 26 | + - ready_for_review |
| 27 | +jobs: |
| 28 | + automerge: |
| 29 | + if: ${{ (github.event.issue.pull_request && !github.event.issue.pull_request.draft) || (github.event.pull_request && !github.event.pull_request.draft) }} |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - name: lookup teams |
| 33 | + id: teams |
| 34 | + uses: tspascoal/get-user-teams-membership@v1 |
| 35 | + with: |
| 36 | + username: "${{ github.actor }}" |
| 37 | + organization: ${{ secrets.CC_TEAM_CONTRIBUTORS_ORG }} |
| 38 | + team: ${{ secrets.CC_TEAM_CONTRIBUTORS_TEAM }} |
| 39 | + GITHUB_TOKEN: "${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" |
| 40 | + - name: approve PR |
| 41 | + if: ${{ steps.teams.outputs.isTeamMember == 'true' && (github.event.action == 'opened' || github.event.action == 'ready_for_review') }} |
| 42 | + uses: andrewmusgrave/automatic-pull-request-review@0.0.5 |
| 43 | + with: |
| 44 | + repo-token: ${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} |
| 45 | + event: APPROVE |
| 46 | + body: | |
| 47 | + :+1: |
| 48 | +
|
| 49 | + When you're ready to merge, add a comment that says |
| 50 | + > @edx-community-bot merge |
| 51 | +
|
| 52 | + and we'll handle the rest! |
| 53 | + CC: @${{ secrets.CC_TEAM_CHAMPIONS }} @${{ secrets.CC_TEAM_CONTRIBUTORS_ORG }}/${{ secrets.CC_TEAM_CONTRIBUTORS_TEAM }} |
| 54 | + - name: label PR as auto-mergeable |
| 55 | + if: ${{ steps.teams.outputs.isTeamMember == 'true' && contains(github.event.comment.body, '@edx-community-bot merge') }} |
| 56 | + uses: andymckay/labeler@978f846c4ca6299fd136f465b42c5e87aca28cac |
| 57 | + with: |
| 58 | + add-labels: 'automerge' |
| 59 | + repo-token: ${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} |
| 60 | + - name: automerge |
| 61 | + uses: "pascalgn/automerge-action@v0.13.1" |
| 62 | + env: |
| 63 | + GITHUB_TOKEN: "${{ secrets.CC_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" |
| 64 | + MERGE_COMMIT_MESSAGE: | |
| 65 | + merge(#{pullRequest.number}): {pullRequest.title} |
| 66 | +
|
| 67 | + {pullRequest.body} |
0 commit comments