Skip to content

docs: Update README.md #2

docs: Update README.md

docs: Update README.md #2

name: final-newline-checker
on:
pull_request:
jobs:
final-newline-checker:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: hakadoriya-actions/[email protected]
id: final-newline-checker
with:
# NOTE: If you want to fail on missing final newline, set this to true
#fail-on-missing: true
#paths: |-
# ^action.yml
# ^missing-final-newline.md
paths-ignore: |-
.*\.gif$
.*\.ico$
.*\.jpeg$
.*\.jpg$
.*\.png$
.*\.svg$
.*\.webp$
- uses: hakadoriya-actions/[email protected]
- name: Submit PR comment if missing final newline
if: ${{ steps.final-newline-checker.outputs.missing == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
# Create comment body
cat <<EOF | perl -pe 's/\\n/\n/g' | tee /tmp/gh-pr-comment-body.md
## 🚨 Missing final newline
The following files are missing final newline.
\`\`\`
${{ steps.final-newline-checker.outputs.missing-files }}
\`\`\`
EOF
# Submit PR comment
gh xz put-annotated-comment ${{ github.repository }} ${{ github.event.number }} annotation:final-newline-checker @/tmp/gh-pr-comment-body.md
# fail the workflow
exit 1