Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: simplify json format/validation action #372

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

lamchau
Copy link
Contributor

@lamchau lamchau commented Aug 20, 2024

Simplified the GitHub Actions workflow in PR #364 😅. This update also fixes an issue where just was missing in the hermit setup, which the previous workflow didn’t catch.

Since just format inherently includes just lint, we can just consolidate that into a single action.

This change removes much of the automation introduced in the earlier PR, placing the responsibility on the author to ensure well-formed JSON is committed to the repository. The original intent was to automate formatting when directly modifying JSON files via the GitHub web interface (bypassing the pre-commit hook). However, after reconsideration, this is likely not the most common workflow and might not be something we should encourage anyway.

Note: We still only check hosted/*.json which are the only assets published to tbdex.dev.

@lamchau lamchau marked this pull request as draft August 20, 2024 23:54
@lamchau lamchau force-pushed the lamchau/fix-workflow branch 6 times, most recently from 4ba22dd to 2c0e405 Compare August 21, 2024 00:30
@lamchau lamchau changed the title fix: add missing pr number and missing push check fix: simplify json format/validation action Aug 21, 2024
@lamchau lamchau marked this pull request as ready for review August 21, 2024 00:47
@lamchau lamchau force-pushed the lamchau/fix-workflow branch 2 times, most recently from f776ed2 to e7eed13 Compare August 25, 2024 09:45
Comment on lines -38 to 43
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just exit 1 right away instead of assigning to a variable and then reading afterwards?

Copy link
Contributor Author

@lamchau lamchau Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could! if the user had 3 malformed files then they'd only see one at a time.

this felt more "ergonomic" to show all the files so potentially it (just lint) could be fixed without having to run it multiple times.

open to either approach!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm for showing all the files that fail lint at once

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah nice, that's better!

Copy link
Contributor

@KendallWeihe KendallWeihe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, so each CI run should execute linting and if it fails then PRs can't be merged until the developer runs just format and commits the changes

@lamchau lamchau merged commit 1d9ff27 into TBD54566975:main Sep 5, 2024
1 check passed
@lamchau lamchau deleted the lamchau/fix-workflow branch September 5, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants