-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (34 loc) · 1.33 KB
/
main.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
37
38
39
40
name: Approval Tracking
on:
issues:
types: [edited]
permissions:
issues: write
jobs:
check_checkbox:
runs-on: ubuntu-latest
steps:
- name: Check if checkbox was edited
id: checkbox_checked
run: |
echo "Issue Body: ${{ github.event.issue.body }}"
echo "User: ${{ github.event.issue.user.login }}"
# Check if any checkbox is checked
if echo "${{ github.event.issue.body }}" | grep -q '\- \[x\]'; then
echo "Checkbox checked."
echo "checkbox_checked=true" >> $GITHUB_OUTPUT
else
echo "No checkbox checked."
echo "checkbox_checked=false" >> $GITHUB_OUTPUT
fi
- name: Comment on Issue
# if: steps.check_checkbox.outputs.checkbox_checked == 'true'
run: |
USERNAME="${{ github.event.issue.user.login }}"
COMMENT="Checkbox checked by @$USERNAME!"
echo "output: ${{steps.check_checkbox.outputs.checkbox_checked}}"
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
-d "{\"body\": \"$COMMENT\"}"