File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ name : PR Check Comment
2+
3+ on :
4+ workflow_run :
5+ workflows : ["PR Check"]
6+ types : [completed]
7+
8+ jobs :
9+ comment :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ pull-requests : write
13+ steps :
14+ - name : Download check results
15+ uses : actions/download-artifact@v4
16+ with :
17+ name : pr-check-output
18+ github-token : ${{ secrets.GITHUB_TOKEN }}
19+ run-id : ${{ github.event.workflow_run.id }}
20+ continue-on-error : true
21+
22+ - name : Post or update PR comment
23+ if : hashFiles('pr_number.txt') != '' && hashFiles('comment.md') != ''
24+ env :
25+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26+ GH_REPO : ${{ github.repository }}
27+ run : |
28+ PR_NUMBER=$(cat pr_number.txt)
29+ COMMENT_BODY=$(cat comment.md)
30+
31+ EXISTING_ID=$(gh api "repos/$GH_REPO/issues/$PR_NUMBER/comments" \
32+ --jq '[.[] | select(.body | contains("<!-- pr-check-bot -->"))] | first | .id // empty')
33+
34+ if [ -n "$EXISTING_ID" ]; then
35+ gh api --method PATCH "repos/$GH_REPO/issues/comments/$EXISTING_ID" \
36+ --field body="$COMMENT_BODY"
37+ else
38+ gh api --method POST "repos/$GH_REPO/issues/$PR_NUMBER/comments" \
39+ --field body="$COMMENT_BODY"
40+ fi
You can’t perform that action at this time.
0 commit comments