pull request linting #191
20
.gitea/workflows/markdownlint_pr.sh
Normal file
20
.gitea/workflows/markdownlint_pr.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Initial commit: $1"
|
||||||
|
echo "Final commit: $2"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# recupera ogni file modificato in questa PR (tra le 2 commit)
|
||||||
|
# considera solo i file che terminano con .md
|
||||||
|
# ogni file viene controllato con markdownlint, con la config comune
|
||||||
|
|
||||||
|
EXIT=0
|
||||||
|
|
||||||
|
while read -r LINE; do
|
||||||
|
echo
|
||||||
|
echo "testing file: $LINE"
|
||||||
|
markdownlint --config .markdownlint.yaml "$LINE" || EXIT=1
|
||||||
|
done < <(git diff --name-only "$1" "$2" content/ | grep \.md$)
|
||||||
|
|
||||||
|
exit ${EXIT}
|
25
.gitea/workflows/unicode_check.yaml
Normal file
25
.gitea/workflows/unicode_check.yaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Linting markdown on PR
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unicode-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: run markdownlint on changed files
|
||||||
|
uses: docker://ghcr.io/igorshubovych/markdownlint-cli
|
||||||
|
with:
|
||||||
|
entrypoint: /bin/sh
|
||||||
|
args: -c 'apk -U add git bash ; bash .gitea/workflows/markdownlint_pr.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}'
|
||||||
|
|
||||||
|
- name: check for unwanted unicode runes
|
||||||
|
run: |
|
||||||
|
bash .gitea/workflows/unwanted_unicode_pr.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
|
6
.gitea/workflows/unwanted_unicode_patterns.grep
Normal file
6
.gitea/workflows/unwanted_unicode_patterns.grep
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
—
|
||||||
|
‘
|
||||||
|
’
|
||||||
|
“
|
||||||
|
”
|
||||||
|
…
|
23
.gitea/workflows/unwanted_unicode_pr.sh
Normal file
23
.gitea/workflows/unwanted_unicode_pr.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Initial commit: $1"
|
||||||
|
echo "Final commit: $2"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# recupera ogni file modificato in questa PR (tra le 2 commit)
|
||||||
|
# considera solo i file che terminano con .md
|
||||||
|
# ogni file viene controllato con grep, con i pattern definiti
|
||||||
|
# nel file di configurazione
|
||||||
|
|
||||||
|
EXIT=0
|
||||||
|
|
||||||
|
while read -r LINE; do
|
||||||
|
if [ -r "$LINE" ] ; then
|
||||||
|
echo
|
||||||
|
echo "testing file: $LINE"
|
||||||
|
grep --color -f .gitea/workflows/unwanted_unicode_patterns.grep "$LINE" && EXIT=1
|
||||||
|
fi
|
||||||
|
done < <(git diff --name-only "$1" "$2" content/ | grep \.md$)
|
||||||
|
|
||||||
|
exit ${EXIT}
|
4
.markdownlint.yaml
Normal file
4
.markdownlint.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# vedi: https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
|
||||||
|
|
||||||
|
default: true
|
||||||
|
MD013: false
|
Loading…
x
Reference in New Issue
Block a user