-
Notifications
You must be signed in to change notification settings - Fork 2
49 lines (46 loc) · 2.59 KB
/
commands-rebase.yml
File metadata and controls
49 lines (46 loc) · 2.59 KB
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
name: rebase-command
on:
repository_dispatch:
types: [rebase-command]
jobs:
rebase:
if: github.event.client_payload.pull_request.rebaseable == true && ((github.event.client_payload.github.payload.comment.author_association == 'MEMBER' || github.event.client_payload.github.payload.comment.author_association == 'OWNER') || github.event.client_payload.github.payload.comment.user.login == github.event.client_payload.pull_request.user.login)
runs-on: ubuntu-latest
steps:
- name: Checkout pull request
uses: actions/checkout@v2
with:
token: ${{ secrets.BOT_TOKEN }}
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.BOT_TOKEN }}@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/create-or-update-comment@v1
with:
token: ${{ secrets.BOT_TOKEN }}
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 || ((github.event.client_payload.github.payload.comment.author_association !== 'MEMBER' || github.event.client_payload.github.payload.comment.author_association !== 'OWNER') || github.event.client_payload.github.payload.comment.user.login !== github.event.client_payload.pull_request.user.login
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.BOT_TOKEN }}
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