Skip to content

Klipper backup stopped working after some days. #28

Klipper backup stopped working after some days.

Klipper backup stopped working after some days. #28

name: Check for Markdown code blocks in Issues
on:
issues:
types: [opened]
permissions:
issues: write
jobs:
check_markdown:
runs-on: ubuntu-latest
name: Markdown issue
steps:
- name: Check if markdown code is used
env:
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
# Check if the issue body contains Markdown inline code or code block (`` ` ``)
if echo "$ISSUE_BODY" | grep -q "\`"; then
echo "Markdown code detected."
echo "markdown_used=true" >> $GITHUB_ENV
else
echo "No Markdown code detected."
echo "markdown_used=false" >> $GITHUB_ENV
fi
- name: Comment on the issue if no Markdown code is detected
if: env.markdown_used == 'false'
env:
ISSUE_NUMBER: ${{ github.event.issue.number }}
REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
COMMENT_BODY="Please use markdown syntax (\`\`) for code snippets in your issue. You have confirmed the checkbox that you are using markdown, but none was recognized here. The markdown syntax makes your issue more readable and makes it easier to find a solution to your problem more quickly.\\n\\nExamples:\nThe symbol \` turns \`code\` into \`code\`.\\n\\nFor more code use \` three times at the beginning and at the end like this:\\n\`\`\`\\nsome\\ncode\\n\`\`\`\\nturns into:\\n\`\`\`\\nsome\\ncode\\n\`\`\`\\nPlease edit your outgoing post immediately. If you think that this hint is not necessary and you have correctly used markdown, then you can simply ignore this message."
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"body\":\"${COMMENT_BODY}\"}" \
"https://api.github.com/repos/${REPO}/issues/${ISSUE_NUMBER}/comments"