1
+ # This workflow is provided via the organization template repository
2
+ #
3
+ # https://github.com/nextcloud/.github
4
+ # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5
+ #
6
+ # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7
+ # SPDX-License-Identifier: MIT
8
+
1
9
name : Compile Command
2
10
on :
3
11
issue_comment :
18
26
base_ref : ${{ steps.comment-branch.outputs.base_ref }}
19
27
20
28
steps :
29
+ - name : Get repository from pull request comment
30
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
31
+ id : get-repository
32
+ with :
33
+ github-token : ${{secrets.GITHUB_TOKEN}}
34
+ script : |
35
+ const pull = await github.rest.pulls.get({
36
+ owner: context.repo.owner,
37
+ repo: context.repo.repo,
38
+ pull_number: context.issue.number
39
+ });
40
+
41
+ const repositoryName = pull.data.head?.repo?.full_name
42
+ console.log(repositoryName)
43
+ return repositoryName
44
+
45
+ - name : Disabled on forks
46
+ if : ${{ fromJSON(steps.get-repository.outputs.result) != github.repository }}
47
+ run : |
48
+ echo 'Can not execute /compile on forks'
49
+ exit 1
50
+
21
51
- name : Check actor permission
22
52
uses : skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
23
53
with :
29
59
token : ${{ secrets.COMMAND_BOT_PAT }}
30
60
repository : ${{ github.event.repository.full_name }}
31
61
comment-id : ${{ github.event.comment.id }}
32
- reactions : " +1 "
62
+ reactions : ' +1 '
33
63
34
64
- name : Parse command
35
65
uses : skjnldsv/parse-command-comment@5c955203c52424151e6d0e58fb9de8a9f6a605a1 # v2
49
79
uses : xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
50
80
id : comment-branch
51
81
82
+ - name : Add reaction on failure
83
+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
84
+ if : failure()
85
+ with :
86
+ token : ${{ secrets.COMMAND_BOT_PAT }}
87
+ repository : ${{ github.event.repository.full_name }}
88
+ comment-id : ${{ github.event.comment.id }}
89
+ reactions : ' -1'
90
+
52
91
process :
53
92
runs-on : ubuntu-latest
54
93
needs : init
@@ -61,38 +100,38 @@ jobs:
61
100
key : git-repo
62
101
63
102
- name : Checkout ${{ needs.init.outputs.head_ref }}
64
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
103
+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
65
104
with :
66
105
token : ${{ secrets.COMMAND_BOT_PAT }}
67
106
fetch-depth : 0
68
107
ref : ${{ needs.init.outputs.head_ref }}
69
108
70
109
- name : Setup git
71
110
run : |
72
- git config --local user.email " nextcloud-command@users.noreply.github.com"
73
- git config --local user.name " nextcloud-command"
111
+ git config --local user.email ' nextcloud-command@users.noreply.github.com'
112
+ git config --local user.name ' nextcloud-command'
74
113
75
114
- name : Read package.json node and npm engines version
76
- uses : skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
115
+ uses : skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
77
116
id : package-engines-versions
78
117
with :
79
118
fallbackNode : ' ^20'
80
119
fallbackNpm : ' ^10'
81
120
82
121
- name : Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
83
- uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
122
+ uses : actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
84
123
with :
85
124
node-version : ${{ steps.package-engines-versions.outputs.nodeVersion }}
86
125
cache : npm
87
126
88
127
- name : Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
89
- run : npm i -g npm@" ${{ steps.package-engines-versions.outputs.npmVersion }}"
128
+ run : npm i -g ' npm@${{ steps.package-engines-versions.outputs.npmVersion }}'
90
129
91
130
- name : Rebase to ${{ needs.init.outputs.base_ref }}
92
131
if : ${{ contains(needs.init.outputs.arg1, 'rebase') }}
93
132
run : |
94
- git fetch origin ${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}
95
- git rebase origin/${{ needs.init.outputs.base_ref }}
133
+ git fetch origin ' ${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}'
134
+ git rebase ' origin/${{ needs.init.outputs.base_ref }}'
96
135
97
136
- name : Install dependencies & build
98
137
env :
@@ -105,30 +144,30 @@ jobs:
105
144
- name : Commit default
106
145
if : ${{ !contains(needs.init.outputs.arg1, 'fixup') && !contains(needs.init.outputs.arg1, 'amend') }}
107
146
run : |
108
- git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
147
+ git add ' ${{ github.workspace }}${{ needs.init.outputs.git_path }}'
109
148
git commit --signoff -m 'chore(assets): Recompile assets'
110
149
111
150
- name : Commit fixup
112
151
if : ${{ contains(needs.init.outputs.arg1, 'fixup') }}
113
152
run : |
114
- git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
153
+ git add ' ${{ github.workspace }}${{ needs.init.outputs.git_path }}'
115
154
git commit --fixup=HEAD --signoff
116
155
117
156
- name : Commit amend
118
157
if : ${{ contains(needs.init.outputs.arg1, 'amend') }}
119
158
run : |
120
- git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
159
+ git add ' ${{ github.workspace }}${{ needs.init.outputs.git_path }}'
121
160
git commit --amend --no-edit --signoff
122
161
# Remove any [skip ci] from the amended commit
123
162
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
124
-
163
+
125
164
- name : Push normally
126
165
if : ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
127
- run : git push origin ${{ needs.init.outputs.head_ref }}
166
+ run : git push origin ' ${{ needs.init.outputs.head_ref }}'
128
167
129
168
- name : Force push
130
169
if : ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
131
- run : git push --force origin ${{ needs.init.outputs.head_ref }}
170
+ run : git push --force origin ' ${{ needs.init.outputs.head_ref }}'
132
171
133
172
- name : Add reaction on failure
134
173
uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
@@ -137,4 +176,4 @@ jobs:
137
176
token : ${{ secrets.COMMAND_BOT_PAT }}
138
177
repository : ${{ github.event.repository.full_name }}
139
178
comment-id : ${{ github.event.comment.id }}
140
- reactions : " -1 "
179
+ reactions : ' -1 '
0 commit comments