Skip to content

My Story

My Story #12

Workflow file for this run

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: check_edit
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!"
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\"}"