Skip to content

CI: Add backporting bot #2

CI: Add backporting bot

CI: Add backporting bot #2

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