2121 test-pr :
2222 name : " Test if pull request is valid"
2323 runs-on : ubuntu-latest
24- if : >
25- github.event.workflow_run.event == 'pull_request' &&
24+ if : >
25+ github.event.workflow_run.event == 'pull_request' &&
2626 github.event.workflow_run.conclusion == 'success'
2727 outputs :
2828 is_valid : ${{ steps.check-pr.outputs.VALID }}
7878 if : ${{ needs.test-pr.outputs.is_valid == 'true' }}
7979 env :
8080 NR : ${{ needs.test-pr.outputs.number }}
81+ permissions :
82+ contents : write
8183 steps :
8284 - name : ' Checkout md outputs'
8385 uses : actions/checkout@v3
@@ -104,9 +106,9 @@ jobs:
104106 git config --local user.name "GitHub Actions"
105107 CURR_HEAD=$(git rev-parse HEAD)
106108 git checkout --orphan md-outputs-PR-${NR}
107- git add -A
109+ git add -A
108110 git commit -m "source commit: ${CURR_HEAD}"
109- ls -A | grep -v '^.git$' | xargs rm -r
111+ ls -A | grep -v '^.git$' | xargs -I _ rm -r '_'
110112 cd ..
111113 unzip -o -d built built.zip
112114 cd built
@@ -122,14 +124,16 @@ jobs:
122124 if : ${{ needs.test-pr.outputs.is_valid == 'true' }}
123125 env :
124126 NR : ${{ needs.test-pr.outputs.number }}
127+ permissions :
128+ pull-requests : write
125129 steps :
126130 - name : ' Download comment artifact'
127131 id : dl
128132 uses : carpentries/actions/download-workflow-artifact@main
129133 with :
130134 run : ${{ github.event.workflow_run.id }}
131135 name : ' diff'
132-
136+
133137 - if : ${{ steps.dl.outputs.success == 'true' }}
134138 run : unzip ${{ github.workspace }}/diff.zip
135139
@@ -138,7 +142,7 @@ jobs:
138142 if : ${{ steps.dl.outputs.success == 'true' }}
139143 uses : carpentries/actions/comment-diff@main
140144 with :
141- pr : ${{ env.NR }}
145+ pr : ${{ env.NR }}
142146 path : ${{ github.workspace }}/diff.md
143147
144148 # Comment if the PR is open and matches the SHA, but the workflow files have
@@ -151,6 +155,8 @@ jobs:
151155 env :
152156 NR : ${{ github.event.workflow_run.pull_requests[0].number }}
153157 body : ${{ needs.test-pr.outputs.msg }}
158+ permissions :
159+ pull-requests : write
154160 steps :
155161 - name : ' Check for spoofing'
156162 id : dl
0 commit comments