-
Notifications
You must be signed in to change notification settings - Fork 242
36 lines (31 loc) · 1.04 KB
/
handler.xkcd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: XKCD Comic Relief
on:
pull_request:
types: [closed]
jobs:
post-xkcd:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
if: github.event.pull_request.merged == true
steps:
- name: Search relif
id: search
run: |
xkcd_url=https://xkcd.com/${{ github.event.pull_request.number }}
xkcd_img_url=$(curl -sL $xkcd_url | \
grep -oe '"https://imgs.xkcd.com/comics/[^"]\+"' | \
sed 's/"//g' | \
head -n1)
echo "xkcd_url=$xkcd_url" >> "$GITHUB_OUTPUT"
echo "xkcd_img_url=$xkcd_img_url" >> "$GITHUB_OUTPUT"
- name: Create relif
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
## XKCD Comic Relif
Link: ${{ steps.search.outputs.xkcd_url }}
![${{ steps.search.outputs.xkcd_url }}](${{ steps.search.outputs.xkcd_img_url }})
reactions: laugh