-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16cfdc7
commit 5aa3996
Showing
4 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Go Fmt | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
go-famt: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Run gofmt | ||
run: | | ||
unformatted=$(gofmt -l .) | ||
if [ -n "$unformatted" ]; then | ||
echo "Unformatted files found:" | ||
echo "$unformatted" | ||
exit 1 | ||
else | ||
echo "All Go files are properly formatted." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Check JSON Formatting | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
json-fmt: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install jq | ||
run: sudo apt-get install -y jq | ||
|
||
- name: Find and check JSON formatting | ||
run: | | ||
unformatted_files=() | ||
for file in $(find ./whitelist -name "*.json"); do | ||
if [ "$(jq . "$file" | diff - "$file")" ]; then | ||
unformatted_files+=("$file") | ||
fi | ||
done | ||
if [ ${#unformatted_files[@]} -gt 0 ]; then | ||
echo "The following JSON files are not formatted correctly:" | ||
printf '%s\n' "${unformatted_files[@]}" | ||
exit 1 | ||
else | ||
echo "All JSON files are properly formatted." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters