Markdown 标记被强制插入空格 #13
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: Check GitHub Issue Spacing | |
on: | |
issues: | |
types: [opened, edited] | |
permissions: | |
contents: read | |
jobs: | |
check-title: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Install pangu.js | |
run: npm install -g pangu | |
- name: Check issue title | |
id: check | |
env: | |
ISSUE_TITLE: ${{ github.event.issue.title }} | |
run: | | |
echo "Checking title: $ISSUE_TITLE" | |
if pangu --check "$ISSUE_TITLE"; then | |
echo "has_proper_spacing=true" >> $GITHUB_OUTPUT | |
else | |
echo "has_proper_spacing=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Comment and close if not proper spacing | |
if: steps.check.outputs.has_proper_spacing == 'false' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: `Hi @${context.payload.issue.user.login},\n\nYou're reporting a text spacing glitch to a software specifically crafted for text spacing, and you can't even manage to write an Issue Title with proper spacing? Security! Security!` | |
}); | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
labels: ['not-proper-spacing'] | |
}); | |
await github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
state: 'closed', | |
state_reason: 'not_planned' | |
}); |