-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ci: Add a new workflow to check and format shell scripts in util
dir
#5077
Conversation
echo "## perform a shell format..." | ||
# ignore the error code because `-d` will always return false when the file has difference | ||
find ${{ env.SCRIPT_DIR }} -name "*.sh" -print0 | xargs -0 shfmt -ln=bash -i 4 -ci -w | ||
- name: Commit any changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please replace it by a failure, not an autofix :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, I'll remove the autofix code.
it didn't run. I guess it is because a new testsuite. |
Yes, I think that's due to that security feature of github where it won't tun unmerged workflows. |
I've removed any write operations. now the job will fail if the code does not meet the formatting specifications. |
Let's try |
And as I've mentioned above, the job will be triggered if we modify the shell script under the |
yeah, please :) |
Hi,
I've added a new GitHub action workflow to resolve #4752. It utilizes
shellcheck
andshfmt
tools to perform checks and formatting on our shell scripts during a push to the main branch or the creation of a PR.As it stands, I would appreciate some input on the following aspects that may require further discussion or decision:
shellcheck
to scrutinize all scripts against thebash
rules. Would this be acceptable or should we strictly adhere to the $shebang rules?shellcheck
Rules: Currently, I've left theshellcheck
rules to their default settings, which still yield a number of warnings: ShellScript/Check. My plan is to address these in an additional commit, but before proceeding, it would be beneficial to determine which rules we should strictly enforce.shfmt
Execution: Onceshfmt
completes successfully, an automatic commit will be added to the main branch. I was wondering if this practice aligns with our workflow expectations.