Skip to content

Commit

Permalink
feat(actions): aggiunta action Run LaTex Checks on PR (#49)
Browse files Browse the repository at this point in the history
Aggiunta una nuova action che effettuerà dei controlli sul codice LaTex
(se presente) automatici per dare immediatamente un feedback su come è
stato scritto (meno errori rilevati probabilmente indicano una buona
impaginazione e scrittura del documento).

L'action inizialmente controlla se file LaTex sono stati aggiunti o
modificati, se così non fosse non viene eseguito nulla.
Nel caso di modifiche o aggiunte vengono fatti partire i seguenti
controlli:

- **Linter Checker**(chktex): controlla la correttezza sintattica di LaTex. 
Rileva incorrettezze come
'usare \log invece che log', 'usare \max invece che max', 'il file LaTex
che stai cercando di includere non esiste', ecc.
- **Style Checker**(textidote): analizza lo
stile di come è stato impaginato e scritto il documento, individua
problemi del tipo: 'hai scritto il nome di una section tutto in
capslock', 'questa section è troppo corta, pensa di farla diventare
parte della section precedente', ecc.
- **Typo Chekcer**(ltex-cli):
controlla la presenza di eventuali errori grammaticali (italiani)
presenti all'interno del documento.

Ho aggiunto anche titoli descrittivi per ognuna delle operazioni che
questa action compie con anche emoji 🚀 .
Il risultato può essere consultato nella tab Checks di ogni pull
request.

#patch
  • Loading branch information
ncvescera authored Jul 30, 2023
2 parents 2ea334a + f535e04 commit 905a68a
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/configs/ltex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ltex.language": "it", "ltex.additionalRules.motherTongue": "en-GB"}
90 changes: 90 additions & 0 deletions .github/workflows/prlinter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: LaTex Cheks 🕵

on:
pull_request:
branches: [master, main]
types:
- opened
- reopened
- synchronize

jobs:
changed-files:
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Looking for changed files 👁
outputs:
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
with:
files: "**.tex"
- run: echo "${{ steps.changed-files.outputs.all_changed_files }}"

linter:
needs: changed-files
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Linter Checker 🖊
if: needs.changed-files.outputs.any_changed == 'true'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Install Chktex
run: sudo apt-get install chktex -y

- name: Run Chktex
id: chktex
run: chktex ${{ needs.changed-files.outputs.all_changed_files }}

styler:
needs: changed-files
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Styler Checker ✨
if: needs.changed-files.outputs.any_changed == 'true'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Setupu Java ☕️
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'

- name: Install textidote
run: wget https://github.com/sylvainhalle/textidote/releases/latest/download/textidote.jar

- name: Run textidote
run: java -jar textidote.jar ${{ needs.changed-files.outputs.all_changed_files }}

typo:
needs: changed-files
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Typo Checker 🔍
if: needs.changed-files.outputs.any_changed == 'true'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Setup Java ☕️
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'

- name: Install ltex-cli
run: wget https://github.com/valentjn/ltex-ls/releases/latest/download/ltex-ls-16.0.0.tar.gz && tar xvf ltex-ls-16.0.0.tar.gz

- name: Run ltex-cli
run: ./ltex-ls-16.0.0/bin/ltex-cli --client-configuration=.github/workflows/configs/ltex.json ${{ needs.changed-files.outputs.all_changed_files }}

0 comments on commit 905a68a

Please sign in to comment.