[BugFix] Revert 63265 and add another config (backport #66542) #62918
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: CI COMMENT TOOLS | |
| on: | |
| issue_comment: | |
| types: [ created ] | |
| jobs: | |
| close: | |
| name: CLOSE PR | |
| runs-on: ubuntu-latest | |
| if: > | |
| contains(github.event.issue.pull_request.html_url, 'pull') && | |
| (contains(github.event.comment.body, '@Mergify close') || | |
| contains(github.event.comment.body, '@Mergifyio close')) | |
| env: | |
| PR_NUMBER: ${{ github.event.issue.number }} | |
| GITHUB_TOKEN: ${{ secrets.PAT }} | |
| steps: | |
| - name: CLOSE | |
| run: | | |
| gh pr close ${PR_NUMBER} -R ${{ github.repository }} -c "PR was manually closed." | |
| automerge: | |
| name: AutoMerge PR | |
| runs-on: ubuntu-latest | |
| if: > | |
| contains(github.event.issue.pull_request.html_url, 'pull') && | |
| contains(github.event.comment.body, '@Mergify automerge') | |
| env: | |
| PR_NUMBER: ${{ github.event.issue.number }} | |
| steps: | |
| - name: BASE REF | |
| id: get_base_ref | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| base_ref=$(gh pr view ${PR_NUMBER} -R ${{ github.repository }} --json baseRefName | jq -r '.baseRefName') | |
| echo "base_ref=${base_ref}" >> $GITHUB_OUTPUT | |
| - name: AutoMerge | |
| if: startsWith(steps.get_base_ref.outputs.base_ref, 'mergify/bp') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT }} | |
| run: | | |
| gh pr merge ${PR_NUMBER} -R ${{ github.repository }} -s --auto | |
| rerun: | |
| name: Rerun | |
| runs-on: ubuntu-latest | |
| if: > | |
| contains(github.event.issue.pull_request.html_url, 'pull') && | |
| contains(github.event.comment.body, 'Re-run the workflow') | |
| env: | |
| PR_NUMBER: ${{ github.event.issue.number }} | |
| GITHUB_TOKEN: ${{ secrets.PAT }} | |
| ROBOT_SERVER: ${{ secrets.ROBOT_URL }} | |
| steps: | |
| - name: CLOSE | |
| run: | | |
| ret=$(curl -sX POST -H "Content-Type: application/json" \ | |
| -d "{\"repository\":\"${GITHUB_REPOSITORY}\", \"pr_id\":\"${PR_NUMBER}\"}" ${ROBOT_SERVER}) | |
| ret_code=$(echo "${ret}" | jq -r '.result') | |
| if [[ '${ret_code}' == "false" ]]; then | |
| echo "Re-run failed!" | |
| exit 1 | |
| fi |