-
Notifications
You must be signed in to change notification settings - Fork 107
70 lines (63 loc) · 2.07 KB
/
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Rebase
on:
repository_dispatch:
types:
- rebase-command
jobs:
rebase:
name: Rebase
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Automatic rebase
uses: giorio94/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
- name: Retrieve rebase commit hash
run: echo "rebasedcommit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
id: rebase-commit-extraction
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CI_TOKEN }}
event-type: test-command
client-payload: |
{
"pull_request": {
"head": {
"sha": "${{ steps.rebase-commit-extraction.outputs.rebasedcommit }}"
}
},
"github": {
"payload": {
"repository": {
"full_name": "${{ github.repository }}"
},
"issue": {
"number": "${{ github.event.client_payload.github.payload.issue.number }}"
}
}
},
"slash_command": {
"command": "test"
}
}
if: github.event.client_payload.slash_command.args.named.test == 'true'
- name: Set the reaction for the comment
id: rebase_reaction
run: |
[[ ${{ job.status }} == 'success' ]] && \
echo "reaction=hooray" >> $GITHUB_OUTPUT || \
echo "reaction=confused" >> $GITHUB_OUTPUT
if: always()
- name: Report status as reaction
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CI_TOKEN }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: '${{ steps.rebase_reaction.outputs.reaction }}'
if: always()