11name : Compile Command
2+
23on :
34 issue_comment :
45 types : [created]
56
7+ permissions :
8+ contents : read
9+
610jobs :
711 init :
812 runs-on : ubuntu-latest
@@ -14,42 +18,74 @@ jobs:
1418 head_ref : ${{ steps.comment-branch.outputs.head_ref }}
1519
1620 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 /composer-update on forks'
41+ exit 1
42+
1743 - name : Check actor permission
18- uses : skjnldsv/check-actor-permission@v2
44+ uses : skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
1945 with :
2046 require : write
2147
2248 - name : Add reaction on start
23- uses : peter-evans/create-or-update-comment@v1
49+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
2450 with :
2551 token : ${{ secrets.COMMAND_BOT_PAT }}
2652 repository : ${{ github.event.repository.full_name }}
2753 comment-id : ${{ github.event.comment.id }}
28- reaction-type : " +1 "
54+ reactions : ' +1 '
2955
3056 - name : Init branch
31- uses : xt0rted/pull-request-comment-branch@v1
57+ uses : xt0rted/pull-request-comment-branch@e8b8daa837e8ea7331c0003c9c316a64c6d8b0b1 # v3.0.0
3258 id : comment-branch
3359
60+ - name : Add reaction on failure
61+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
62+ if : failure()
63+ with :
64+ token : ${{ secrets.COMMAND_BOT_PAT }}
65+ repository : ${{ github.event.repository.full_name }}
66+ comment-id : ${{ github.event.comment.id }}
67+ reactions : ' -1'
68+
3469 process :
3570 runs-on : ubuntu-latest
3671 needs : init
3772
3873 steps :
3974 - name : Checkout ${{ needs.init.outputs.head_ref }}
40- uses : actions/checkout@v2
75+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4176 with :
77+ persist-credentials : false
4278 token : ${{ secrets.COMMAND_BOT_PAT }}
4379 fetch-depth : 0
4480 ref : ${{ needs.init.outputs.head_ref }}
4581
4682 - name : Setup git
4783 run : |
48- git config --local user.email " nextcloud-command@users.noreply.github.com"
49- git config --local user.name " nextcloud-command"
84+ git config --local user.email ' nextcloud-command@users.noreply.github.com'
85+ git config --local user.name ' nextcloud-command'
5086
5187 - name : Set up php
52- uses : shivammathur/setup-php@master
88+ uses : shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
5389 with :
5490 php-version : 8.1
5591 coverage : none
@@ -73,13 +109,13 @@ jobs:
73109 run : |
74110 git add .
75111 git commit --signoff -m 'chore(autoloader): Dump autoloader'
76- git push --force origin ${{ needs.init.outputs.head_ref }}
112+ git push --force origin ' ${{ needs.init.outputs.head_ref }}'
77113
78114 - name : Add reaction on failure
79- uses : peter-evans/create-or-update-comment@v1
115+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
80116 if : failure()
81117 with :
82118 token : ${{ secrets.COMMAND_BOT_PAT }}
83- repository : ${{ github.event.repository.full_name }}
84- comment-id : ${{ github.event.comment.id }}
85- reaction-type : " -1 "
119+ repository : ' ${{ github.event.repository.full_name }}'
120+ comment-id : ' ${{ github.event.comment.id }}'
121+ reactions : ' -1 '
0 commit comments