Skip to content

Commit 8d06d6a

Browse files
Merge pull request #620 from nextcloud/ci/noid/update-workflow-109
ci: Update workflows
2 parents dd0259b + 1404166 commit 8d06d6a

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/command-compile.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,28 @@ jobs:
1818
base_ref: ${{ steps.comment-branch.outputs.base_ref }}
1919

2020
steps:
21+
- name: Get repository from pull request comment
22+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
23+
id: get-repository
24+
with:
25+
github-token: ${{secrets.GITHUB_TOKEN}}
26+
script: |
27+
const pull = await github.rest.pulls.get({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
pull_number: context.issue.number
31+
});
32+
33+
const repositoryName = pull.data.head?.repo?.full_name
34+
console.log(repositoryName)
35+
return repositoryName
36+
37+
- name: Disabled on forks
38+
if: ${{ fromJSON(steps.get-repository.outputs.result) != github.repository }}
39+
run: |
40+
echo 'Can not execute /compile on forks'
41+
exit 1
42+
2143
- name: Check actor permission
2244
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
2345
with:
@@ -87,7 +109,7 @@ jobs:
87109

88110
- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
89111
run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
90-
112+
91113
- name: Rebase to ${{ needs.init.outputs.base_ref }}
92114
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
93115
run: |
@@ -107,7 +129,7 @@ jobs:
107129
run: |
108130
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
109131
git commit --signoff -m 'chore(assets): Recompile assets'
110-
132+
111133
- name: Commit fixup
112134
if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
113135
run: |
@@ -121,7 +143,7 @@ jobs:
121143
git commit --amend --no-edit --signoff
122144
# Remove any [skip ci] from the amended commit
123145
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
124-
146+
125147
- name: Push normally
126148
if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
127149
run: git push origin ${{ needs.init.outputs.head_ref }}

0 commit comments

Comments
 (0)