[FR] Add options to the autofocus function. After pressing ctrl+v, autofocus first and then paste, instead of autofocus directly. #42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |