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+
19name : Compile Command
210on :
311 issue_comment :
1826 base_ref : ${{ steps.comment-branch.outputs.base_ref }}
1927
2028 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+
2151 - name : Check actor permission
2252 uses : skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
2353 with :
@@ -29,10 +59,10 @@ jobs:
2959 token : ${{ secrets.COMMAND_BOT_PAT }}
3060 repository : ${{ github.event.repository.full_name }}
3161 comment-id : ${{ github.event.comment.id }}
32- reactions : " +1 "
62+ reactions : ' +1 '
3363
3464 - name : Parse command
35- uses : skjnldsv/parse-command-comment@d8c0034c481b791dd6348fcacd9c510dc3a4cb4f # v2
65+ uses : skjnldsv/parse-command-comment@5c955203c52424151e6d0e58fb9de8a9f6a605a1 # v2
3666 id : command
3767
3868 # Init path depending on which command is run
4979 uses : xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
5080 id : comment-branch
5181
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+
5291 process :
5392 runs-on : ubuntu-latest
5493 needs : init
@@ -61,38 +100,38 @@ jobs:
61100 key : git-repo
62101
63102 - name : Checkout ${{ needs.init.outputs.head_ref }}
64- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
103+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
65104 with :
66105 token : ${{ secrets.COMMAND_BOT_PAT }}
67106 fetch-depth : 0
68107 ref : ${{ needs.init.outputs.head_ref }}
69108
70109 - name : Setup git
71110 run : |
72- git config --local user.email " [email protected] " 73- git config --local user.name " nextcloud-command"
111+ git config --local user.email ' [email protected] ' 112+ git config --local user.name ' nextcloud-command'
74113
75114 - 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
77116 id : package-engines-versions
78117 with :
79118 fallbackNode : ' ^20'
80119 fallbackNpm : ' ^10'
81120
82121 - name : Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
83- uses : actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
122+ uses : actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
84123 with :
85124 node-version : ${{ steps.package-engines-versions.outputs.nodeVersion }}
86125 cache : npm
87126
88127 - 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 }}'
90129
91130 - name : Rebase to ${{ needs.init.outputs.base_ref }}
92131 if : ${{ contains(needs.init.outputs.arg1, 'rebase') }}
93132 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 }}'
96135
97136 - name : Install dependencies & build
98137 env :
@@ -105,30 +144,30 @@ jobs:
105144 - name : Commit default
106145 if : ${{ !contains(needs.init.outputs.arg1, 'fixup') && !contains(needs.init.outputs.arg1, 'amend') }}
107146 run : |
108- git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
147+ git add ' ${{ github.workspace }}${{ needs.init.outputs.git_path }}'
109148 git commit --signoff -m 'chore(assets): Recompile assets'
110149
111150 - name : Commit fixup
112151 if : ${{ contains(needs.init.outputs.arg1, 'fixup') }}
113152 run : |
114- git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
153+ git add ' ${{ github.workspace }}${{ needs.init.outputs.git_path }}'
115154 git commit --fixup=HEAD --signoff
116155
117156 - name : Commit amend
118157 if : ${{ contains(needs.init.outputs.arg1, 'amend') }}
119158 run : |
120- git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
159+ git add ' ${{ github.workspace }}${{ needs.init.outputs.git_path }}'
121160 git commit --amend --no-edit --signoff
122161 # Remove any [skip ci] from the amended commit
123162 git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
124-
163+
125164 - name : Push normally
126165 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 }}'
128167
129168 - name : Force push
130169 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 }}'
132171
133172 - name : Add reaction on failure
134173 uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
@@ -137,4 +176,4 @@ jobs:
137176 token : ${{ secrets.COMMAND_BOT_PAT }}
138177 repository : ${{ github.event.repository.full_name }}
139178 comment-id : ${{ github.event.comment.id }}
140- reactions : " -1 "
179+ reactions : ' -1 '
0 commit comments