Skip to content

Commit a2021bc

Browse files
committed
Create pr_check.yml
1 parent 3c0320b commit a2021bc

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/pr_check.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Check Issue Checkboxes
2+
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
7+
jobs:
8+
check-checkboxes:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check if Issue has the 'missing transcript' label
13+
id: label-check
14+
run: |
15+
echo "labels=${{ toJson(github.event.issue.labels) }}" > labels.json
16+
if grep -q 'missing transcript' labels.json; then
17+
echo "missing_transcript=true" >> $GITHUB_ENV
18+
else
19+
echo "missing_transcript=false" >> $GITHUB_ENV
20+
fi
21+
22+
- name: Check for unchecked checkboxes
23+
id: check
24+
if: ${{ env.missing_transcript == 'true' }}
25+
run: |
26+
ISSUE_BODY="${{ github.event.issue.body }}"
27+
28+
# Extract unchecked checkboxes
29+
UNCHECKED=$(echo "$ISSUE_BODY" | grep -E '- \[ \]' | wc -l)
30+
31+
# If found any unchecked checkboxes, set output to true
32+
if [ "$UNCHECKED" -gt 0 ]; then
33+
echo "unchecked=true" >> $GITHUB_ENV
34+
echo "Unchecked checkboxes found!"
35+
else
36+
echo "unchecked=false" >> $GITHUB_ENV
37+
fi
38+
39+
- name: Comment on Issue if unchecked checkboxes are found
40+
if: ${{ env.unchecked == 'true' && env.missing_transcript == 'true' }}
41+
uses: peter-evans/create-or-update-comment@v4
42+
with:
43+
issue-number: ${{ github.event.issue.number }}
44+
body: |
45+
⚠️ It looks like some checkboxes in your issue are not checked.
46+
Please ensure you have confirmed all the checkboxes are valid before opening an issue.
47+
The issue will be closed if the checkboxes are not checked.

0 commit comments

Comments
 (0)