unicode check action #1

Open
paspo wants to merge 28 commits from unicode-check into main
8 changed files with 128 additions and 0 deletions

View 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}

View File

@ -0,0 +1,51 @@
---
name: Check for disallowed chars
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: vai
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 }}
# - name: Getting changed files
# id: file-lister
# shell: bash
# run: |
# echo "Initial commit: ${{ github.event.pull_request.base.sha }}"
# echo "Final commit: ${{ github.event.pull_request.head.sha }}"
# echo "File list:"
# while read LINE; do
# echo $LINE
# LINASDASDSAE=$(printf %q "$LINE")
# F="$F $(echo "${LINE}"|sed 's/\ /\\ /')"
# done < <(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} content/ | grep \.md$)
# echo "FILELIST=$F" >> "$GITHUB_OUTPUT"
# - name: Markdown Lint
# env:
# FILELIST: ${{ steps.file-lister.outputs.FILELIST }}
# uses: nosborn/github-action-markdown-cli@v3.3.0
# with:
# files: "${{ env.FILELIST }}"
# # entrypoint: /bin/sh
# # args: -c 'set'
# config_file: .markdownlint.yaml
# dot: false

View File

@ -0,0 +1,6 @@

View 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
View File

@ -0,0 +1,4 @@
# vedi: https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
default: true
MD013: false

10
content/delme anche.mda Normal file
View File

@ -0,0 +1,10 @@
---
title: no
---
invalid char: ``
asdasd
asdaksjdlaj slkas jdlkajs ldkasj lkasj dlkasjdlk ajsldkajs dlkjasklsaj lkaj sldkj lkej lkeajf alsdkjf asldkfj
anche!!!

5
content/delme.mda Normal file
View File

@ -0,0 +1,5 @@
---
title: no
---
invalid char: ``

9
content/delme2.mda Normal file
View File

@ -0,0 +1,9 @@
---
title: no
---
invalid char: ``
asdasd
asdaksjdlaj slkas jdlkajs ldkasj lkasj dlkasjdlk ajsldkajs dlkjasklsaj lkaj sldkj lkej lkeajf alsdkjf asldkfj