Add a slightly better linter check (#2446)

* Remove the NPM cache from the validate_icons step

* Add a prettier formatting check

---------

Co-authored-by: ligi <ligi@ligi.de>
This commit is contained in:
Vladimir Pouzanov 2023-03-18 17:37:17 +00:00 committed by GitHub
parent cd4e352b0a
commit 93c61b12f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 10 deletions

View File

@ -24,15 +24,6 @@ jobs:
files: _data/icons/*.json files: _data/icons/*.json
base_sha: ${{ steps.last_successful_commit_push.outputs.base }} base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
- name: Configure npm Caching
uses: actions/cache@v2
if: steps.changed-icons.outputs.any_changed == 'true'
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/workflows/validate_json.yml') }}
restore-keys: |
${{ runner.os }}-npm-
- run: sudo apt-get -y install jq curl exiftool - run: sudo apt-get -y install jq curl exiftool
- name: Verify the changed icons - name: Verify the changed icons
@ -97,3 +88,37 @@ jobs:
fi fi
done done
exit $BAD exit $BAD
validate_formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v3
id: last_successful_commit_push
with:
main-branch-name: master
workflow-id: 'pr_checks.yml'
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
with:
files: _data/*/*.json
base_sha: ${{ steps.last_successful_commit_push.outputs.base }}
- run: sudo npm i -g prettier
- name: Verify the changed icons
if: steps.changed-files.outputs.any_changed == 'true'
run: |
set -euo pipefail
BAD=0
for CHANGED_FILE in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "Checking $CHANGED_FILE"
diff -u "$CHANGED_FILE" <(prettier "$CHANGED_FILE")
done

View File

@ -2,7 +2,6 @@ name: Run prettier
on: on:
push: push:
pull_request:
jobs: jobs:
prettier: prettier: