1- # By calling this ci via `workflow_call` from another ci it has permissions to comment on prs from forks
2- # This action expects the a artifact named `content` to be present in the workflow run
3- # If the artifact contains a pr_number.txt, the action will comment on that pr. If not it comments on the commit.
4- # The content of the messages composed by concatinating all *.txt files within content into a single file
5- # If you want to enforce a specific order, you need to name the files in a way that sorts in the desired order
6- name : Comment
1+ name : PR Comment
72
83on :
94 workflow_run :
@@ -20,49 +15,6 @@ permissions:
2015
2116jobs :
2217 comment :
23- name : Comment Bot
24- runs-on : ubuntu-latest
25- steps :
26- - uses : actions/download-artifact@v4
27- with :
28- name : content
29- path : /tmp/content
30- run-id : ${{ github.event.workflow_run.id }}
31- github-token : ${{ secrets.READ_ONLY_PAT || github.token }}
32-
33- - name : Read pr number
34- id : get_pr_number
35- run : |
36- echo "pr_number=$(cat /tmp/content/pr_number.txt)" >> $GITHUB_OUTPUT
37- rm /tmp/content/pr_number.txt
38-
39- - name : Combine
40- id : combine
41- run : cat /tmp/content/*.txt > /tmp/all.txt
42-
43- - name : Find Comment
44- uses : peter-evans/find-comment@v3
45- id : fc
46- if : ${{ steps.get_pr_number.outputs.pr_number != null }}
47- with :
48- issue-number : ${{ steps.get_pr_number.outputs.pr_number }}
49- comment-author : " github-actions[bot]"
50- token : ${{ secrets.READ_ONLY_PAT || github.token }}
51-
52- - name : Create or update pr comment
53- uses : peter-evans/create-or-update-comment@v4
54- if : ${{ steps.get_pr_number.outputs.pr_number != null }}
55- with :
56- comment-id : ${{ steps.fc.outputs.comment-id }}
57- issue-number : ${{ steps.get_pr_number.outputs.pr_number }}
58- body-file : /tmp/all.txt
59- edit-mode : replace
60- token : ${{ secrets.READ_ONLY_PAT || github.token }}
61-
62- - name : Create or update commit comment
63- uses : peter-evans/commit-comment@v3
64- if : ${{ steps.get_pr_number.outputs.pr_number == null }}
65- with :
66- sha : ${{ github.event.workflow_run.head_sha }}
67- body-file : /tmp/all.txt
68- token : ${{ secrets.READ_ONLY_PAT || github.token }}
18+ uses : bgd-labs/github-workflows/.github/workflows/comment.yml@main
19+ secrets :
20+ READ_ONLY_PAT : ${{ secrets.READ_ONLY_PAT }}
0 commit comments