CI: Add backporting bot #2
Workflow file for this run
This file contains 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: Backport | |
on: | |
issue_comment: | |
types: [created] | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
bench: | |
if: | | |
github.event.issue.pull_request != null && | |
contains(github.event.comment.body, '/backport') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: ACK Comment | |
run: | | |
gh api -X POST /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --input - <<EOF | |
{ | |
"content": "rocket" | |
} | |
EOF | |
- name: Check Branch | |
if: github.event.issue.pull_request.base.ref != 'master' | |
run: | | |
gh issue comment ${{ github.event.issue.number }} --body "🤖 Backport: error: can only backport Pull Requests that target branch 'master'" | |
exit 1 | |
- name: Comment | |
run: | | |
COMMENT_ID=$(gh issue comment ${{ github.event.issue.number }} --json id --jq '.id' --body \ | |
"🤖 Backport: starting CI process, you can cancel it [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})") | |
echo "COMMENT_ID=$COMMENT_ID" >> $GITHUB_ENV |