Skip to content

Commit

Permalink
fix: simplify lint and format workflow (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
lamchau authored Sep 5, 2024
1 parent 725e21c commit 1d9ff27
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 137 deletions.
62 changes: 0 additions & 62 deletions .github/workflows/format.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/lint.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/trigger-lint.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/validate-json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: validate-json
on:
push:
branches:
- "**"

pull_request:
types:
- opened
- synchronize

jobs:
format:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4

- uses: cashapp/activate-hermit@v1
name: setup hermit with `just` and `jq`
with:
cache: true

- name: format json files
id: format-json
run: just format
8 changes: 3 additions & 5 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ lint: clean
exit 1
fi
no_errors_found=true
has_errors=false
for file in $(find hosted -type f -name "*.json"); do
if ! jq empty $file > /dev/null; then
printf "[error] %s is not a valid JSON file\n\n" $file
no_errors_found=false
has_errors=true
fi
done

if [ "$no_errors_found" = true ]; then
echo "[success] All JSON files are valid"
else
if [ "$has_errors" = true ]; then
exit 1
fi

Expand Down
1 change: 1 addition & 0 deletions bin/.just-1.34.0.pkg
1 change: 1 addition & 0 deletions bin/just
7 changes: 1 addition & 6 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#!/usr/bin/env bash

if just lint; then
echo "[success] linting passed"
else
echo "[error] linting failed"
exit 1
fi
just format

0 comments on commit 1d9ff27

Please sign in to comment.