Skip to content

Commit 4a56d15

Browse files
committed
test: wip: comment under pr
1 parent e9173b7 commit 4a56d15

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/vrt2.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: PR Image Comment
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: Install ImageMagick
15+
run: sudo apt-get update && sudo apt-get install -y imagemagick
16+
17+
- name: Generate an image (example)
18+
run: |
19+
convert -size 100x100 xc:blue image.png # Creates a 100x100 blue image
20+
21+
- name: Upload artifact
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: pr-image
25+
path: image.png
26+
27+
comment-with-link:
28+
needs: generate-image
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Post comment with artifact link
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
run: |
35+
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
36+
37+
COMMENT_BODY="The generated image is available as an artifact. You can download it [here]($ARTIFACT_URL)."
38+
39+
gh api --method POST /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
40+
-f body="$COMMENT_BODY"
41+

0 commit comments

Comments
 (0)