-
Notifications
You must be signed in to change notification settings - Fork 648
111 lines (102 loc) · 3.71 KB
/
Copy pathcommand_dispatcher.yaml
File metadata and controls
111 lines (102 loc) · 3.71 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
on:
issue_comment:
types: [created]
permissions:
contents: write
actions: write
issues: write
pull-requests: write
jobs:
check-permission:
runs-on: ubuntu-latest
outputs:
allowed: ${{ steps.permission.outputs.allowed }}
steps:
- uses: actions/checkout@v4
- id: permission
uses: ./.github/actions/check-permission
with:
user: ${{ github.event.comment.user.login }}
allowed-users: yujonglee|ComputelessComputer|goranmoomin|elstua
parse-stable-options:
needs: check-permission
if: needs.check-permission.outputs.allowed == 'true' && contains(github.event.comment.body, '/stable')
runs-on: ubuntu-latest
outputs:
publish: ${{ steps.parse.outputs.publish }}
steps:
- id: parse
env:
COMMENT: ${{ github.event.comment.body }}
run: |
PUBLISH="true"
if [[ "$COMMENT" =~ --no-publish ]]; then
PUBLISH="false"
fi
echo "publish=$PUBLISH" >> $GITHUB_OUTPUT
handle-stable:
needs: [check-permission, parse-stable-options]
if: needs.check-permission.outputs.allowed == 'true' && contains(github.event.comment.body, '/stable')
uses: ./.github/workflows/handle_release.yaml
with:
channel: stable
publish: ${{ needs.parse-stable-options.outputs.publish == 'true' }}
issue_number: ${{ github.event.issue.number }}
comment_id: ${{ github.event.comment.id }}
secrets: inherit
parse-staging-ref:
needs: check-permission
if: needs.check-permission.outputs.allowed == 'true' && contains(github.event.comment.body, '/staging')
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.parse.outputs.ref }}
steps:
- id: parse
env:
COMMENT: ${{ github.event.comment.body }}
run: |
if [[ "$COMMENT" =~ /staging[[:space:]]+([a-zA-Z0-9_.][a-zA-Z0-9_./-]*)($|[[:space:]]) ]]; then
echo "ref=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
fi
handle-staging:
needs: [check-permission, parse-staging-ref]
if: needs.check-permission.outputs.allowed == 'true' && contains(github.event.comment.body, '/staging')
uses: ./.github/workflows/handle_staging.yaml
with:
ref: ${{ needs.parse-staging-ref.outputs.ref }}
issue_number: ${{ github.event.issue.number }}
comment_id: ${{ github.event.comment.id }}
secrets: inherit
handle-update:
needs: check-permission
if: needs.check-permission.outputs.allowed == 'true' && contains(github.event.comment.body, '/update')
uses: ./.github/workflows/handle_update.yaml
with:
issue_number: ${{ github.event.issue.number }}
comment_id: ${{ github.event.comment.id }}
secrets: inherit
parse-changelog-channel:
needs: check-permission
if: needs.check-permission.outputs.allowed == 'true' && contains(github.event.comment.body, '/changelog')
runs-on: ubuntu-latest
outputs:
channel: ${{ steps.parse.outputs.channel }}
steps:
- id: parse
env:
COMMENT: ${{ github.event.comment.body }}
run: |
if [[ "$COMMENT" =~ /changelog[[:space:]]+(stable)($|[[:space:]]) ]]; then
echo "channel=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
else
echo "channel=stable" >> $GITHUB_OUTPUT
fi
handle-changelog:
needs: [check-permission, parse-changelog-channel]
if: needs.check-permission.outputs.allowed == 'true' && contains(github.event.comment.body, '/changelog')
uses: ./.github/workflows/changelog.yaml
with:
channel: ${{ needs.parse-changelog-channel.outputs.channel }}
issue_number: ${{ github.event.issue.number }}
comment_id: ${{ github.event.comment.id }}
secrets: inherit