.github/workflows/rebase-pr.yml

28 lines · 961 bytes

 1# Rebase a pull request, triggered by comment containing `/rebase`
 2name: ⏩ Rebase PR
 3on:
 4  issue_comment:
 5    types: [created]
 6jobs:
 7  rebase:
 8    name: Rebase
 9    if: >-
10      github.event.issue.pull_request != '' && 
11      (
12        contains(github.event.comment.body, '/rebase') || 
13        contains(github.event.comment.body, '/autosquash')
14      )
15    runs-on: ubuntu-latest
16    steps:
17      - name: Checkout the latest code
18        uses: actions/checkout@v2
19        with:
20          token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
21          fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
22      - name: Automatic Rebase
23        uses: cirrus-actions/rebase@1.7
24        with:
25          autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }}
26        env:
27          GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
28