2020  #   - no .github files were committed
2121  test-pr :
2222    name : " Test if pull request is valid" 
23-     runs-on : ubuntu-latest  
24-     if : >   
25-       github.event.workflow_run.event == 'pull_request' &&   
23+     runs-on : ubuntu-22.04  
24+     if : > 
25+       github.event.workflow_run.event == 'pull_request' && 
2626      github.event.workflow_run.conclusion == 'success' 
2727outputs :
2828      is_valid : ${{ steps.check-pr.outputs.VALID }} 
@@ -74,13 +74,15 @@ jobs:
7474  create-branch :
7575    name : " Create Git Branch" 
7676    needs : test-pr 
77-     runs-on : ubuntu-latest  
77+     runs-on : ubuntu-22.04  
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' 
83-         uses : actions/checkout@v3  
85+         uses : actions/checkout@v4  
8486        with :
8587          ref : md-outputs 
8688          path : built 
@@ -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 
@@ -118,18 +120,20 @@ jobs:
118120  comment-pr :
119121    name : " Comment on Pull Request" 
120122    needs : [test-pr, create-branch] 
121-     runs-on : ubuntu-latest  
123+     runs-on : ubuntu-22.04  
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,19 +142,21 @@ 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
145149  #  changed
146150  comment-changed-workflow :
147151    name : " Comment if workflow files have changed" 
148152    needs : test-pr 
149-     runs-on : ubuntu-latest  
153+     runs-on : ubuntu-22.04  
150154    if : ${{ always() && needs.test-pr.outputs.is_valid == 'false' }} 
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 
@@ -176,4 +182,3 @@ jobs:
176182        with :
177183          pr : ${{ env.NR }} 
178184          body : ${{ env.body }} 
179- 
0 commit comments