File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ name : comment image under PR
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize]
6+
7+ jobs :
8+ generate-image :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Checkout code
12+ uses : actions/checkout@v4
13+
14+ - name : Generate an image (example)
15+ run : |
16+ convert -size 100x100 xc:blue image.png
17+
18+ - name : Upload artifact
19+ uses : actions/upload-artifact@v4
20+ with :
21+ name : pr-image
22+ path : image.png
23+
24+ comment-with-image :
25+ needs : generate-image
26+ runs-on : ubuntu-latest
27+ steps :
28+ - name : Download artifact
29+ uses : actions/download-artifact@v4
30+ with :
31+ name : pr-image
32+ path : .
33+
34+ - name : Upload image to GitHub Issue
35+ env :
36+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37+ run : |
38+ IMG_URL=$(gh api \
39+ --method POST \
40+ -H "Accept: application/vnd.github.v3+json" \
41+ -F "file=@image.png" \
42+ /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments)
43+
44+ COMMENT_URL=$(echo $IMG_URL | jq -r .url)
45+
46+ gh api --method POST /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
47+ -f body="Here is the generated image: "
48+
You can’t perform that action at this time.
0 commit comments