26
26
base_ref : ${{ steps.comment-branch.outputs.base_ref }}
27
27
28
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
+
29
51
- name : Check actor permission
30
52
uses : skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
31
53
with :
95
117
96
118
- name : Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
97
119
run : npm i -g 'npm@${{ steps.package-engines-versions.outputs.npmVersion }}'
98
-
120
+
99
121
- name : Rebase to ${{ needs.init.outputs.base_ref }}
100
122
if : ${{ contains(needs.init.outputs.arg1, 'rebase') }}
101
123
run : |
@@ -115,7 +137,7 @@ jobs:
115
137
run : |
116
138
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
117
139
git commit --signoff -m 'chore(assets): Recompile assets'
118
-
140
+
119
141
- name : Commit fixup
120
142
if : ${{ contains(needs.init.outputs.arg1, 'fixup') }}
121
143
run : |
@@ -129,7 +151,7 @@ jobs:
129
151
git commit --amend --no-edit --signoff
130
152
# Remove any [skip ci] from the amended commit
131
153
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
132
-
154
+
133
155
- name : Push normally
134
156
if : ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
135
157
run : git push origin '${{ needs.init.outputs.head_ref }}'
0 commit comments