Skip to content

[FR] Add options to the autofocus function. After pressing ctrl+v, autofocus first and then paste, instead of autofocus directly. #42

[FR] Add options to the autofocus function. After pressing ctrl+v, autofocus first and then paste, instead of autofocus directly.

[FR] Add options to the autofocus function. After pressing ctrl+v, autofocus first and then paste, instead of autofocus directly. #42

name: Validate debug info in bug reports
on:
issues:
types:
- opened
jobs:
validate-debug-info:
if: contains(github.event.issue.labels.*.name, 'bug') # Only run for issues labeled "bug"
runs-on: ubuntu-latest
steps:
- name: Validate "Debug info" section
env:
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Minimum number of characters required in the "Debug info" section
MINIMUM_CHARACTERS=100
# Extract the content of the "Debug info" section (if it exists)
DEBUG_INFO_CONTENT=$(echo "$ISSUE_BODY" | sed -n '/### Debug info/,/^### /p' | sed '1d;$d')
# Validate the content length
if [ ${#DEBUG_INFO_CONTENT} -lt $MINIMUM_CHARACTERS ]; then
echo "⚠️ 'Debug info' section is missing."
COMMENT_BODY="**🚨 Oops! Looks like the Debug Info section got left out. 🚨**\n\nDebugging without this information is often *painfully* slow — it is like trying to solve a mystery without clues. 😅\n\nPlease run the \`PDF++: Copy debug info\` command and paste the result into that section.\n\nThanks! 🙌"
# Post a comment back to the issue
curl -X POST -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"body\": \"$COMMENT_BODY\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}/comments"
# Fail the job to indicate invalid debug info
exit 1
else
echo "✅ 'Debug info' section is valid."
fi