-
Notifications
You must be signed in to change notification settings - Fork 412
52 lines (47 loc) · 2.02 KB
/
cmd-rebase.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: /rebase command
on:
repository_dispatch:
types: [rebase-command]
defaults:
run:
shell: bash
jobs:
rebase:
if: github.event.client_payload.pull_request.rebaseable == true
runs-on: ubuntu-latest
steps:
- name: Checkout pull request
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_GHOST }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
fetch-depth: 0
- name: Rebase
run: |
git config --global user.name '${{ github.event.client_payload.github.actor }}'
git config --global user.email '${{ github.event.client_payload.github.actor }}@users.noreply.github.com'
git remote add base https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.event.client_payload.pull_request.base.repo.full_name }}.git
git fetch base ${{ github.event.client_payload.pull_request.base.ref }}
git rebase base/${{ github.event.client_payload.pull_request.base.ref }}
git push --force-with-lease
- name: Update comment
uses: peter-evans/[email protected]
with:
token: ${{ secrets.PAT_GHOST }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: Pull request successfully rebased
reaction-type: hooray
notRebaseable:
if: github.event.client_payload.pull_request.rebaseable != true
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: peter-evans/[email protected]
with:
token: ${{ secrets.PAT_GHOST }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: Pull request is not rebaseable
reaction-type: hooray