-
Notifications
You must be signed in to change notification settings - Fork 4
Shellcheck shared action #44
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
95a75ce
add shellcheck action
YanxuanLiu 9991d17
fix nits
YanxuanLiu 18da2c4
test shell
YanxuanLiu c6442a9
remove test
YanxuanLiu 44bb30c
fix bug of apt
YanxuanLiu b6d52c2
fix nits
YanxuanLiu e8fec31
report
YanxuanLiu 13e8592
fix bug
YanxuanLiu 2d0d448
error handle
YanxuanLiu 2d03c24
skip error
YanxuanLiu ad863d5
test shellcheck action
YanxuanLiu 4377b7f
severity error
YanxuanLiu d390661
change severity to warning
YanxuanLiu 2d9282a
remove severity
YanxuanLiu 2823c7f
remove action
YanxuanLiu 185851d
version 0.9.0
YanxuanLiu 23f501a
remove
YanxuanLiu 1a70672
remove version
YanxuanLiu bcd399f
commen
YanxuanLiu 0a2b23f
add shellcheck action
YanxuanLiu 6bb93fe
Merge remote-tracking branch 'upstream/main' into shellcheck
YanxuanLiu a0bbd25
change branch
YanxuanLiu 86360d5
Merge branch 'main' into shellcheck
YanxuanLiu 277f946
remove checkout param
YanxuanLiu c25d393
Update shell-check/action.yml
YanxuanLiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,84 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: 'Shell Check' | ||
| description: 'Check shell syntax' | ||
| inputs: | ||
| excluded_codes: | ||
| description: "Excluded issue codes (comma-separated). e.g. SC2086,SC2046" | ||
| required: false | ||
| type: string | ||
| default: "" | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Configure ShellCheck Options | ||
| shell: bash | ||
| run: | | ||
| base_excludes=( | ||
| # Double quote to prevent globbing and word splitting. | ||
| "SC2086" | ||
| # Quote this to prevent word splitting. | ||
| "SC2046" | ||
| # Declare and assign separately to avoid masking return values. | ||
| "SC2155" | ||
| # Use $(...) notation instead of legacy backticks `...`. | ||
| "SC2006" | ||
| # Variable referenced but not assigned | ||
| "SC2154" | ||
| # Ranges can only match single chars (mentioned due to duplicates). | ||
| "SC2102" | ||
| # Prefer mapfile or read -a to split command output (or quote to avoid splitting). | ||
| "SC2207" | ||
| # Note that A && B || C is not if-then-else. C may run when A is true. | ||
| "SC2015" | ||
| # Argument mixes string and array. Use * or separate argument. | ||
| "SC2145" | ||
| # Variable appears unused. Verify use (or export if used externally). | ||
| "SC2034" | ||
| # Not following: File was not specified as input (see shellcheck -x). | ||
| "SC1091" | ||
| # Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames. | ||
| "SC2010" | ||
| # This does not export 'VAR'. Remove $/${} for that, or use ${var?} to quiet. | ||
| "SC2163" | ||
| # See if you can use ${variable//search/replace} instead. | ||
| "SC2001" | ||
| # Use find instead of ls to better handle non-alphanumeric filenames. | ||
| "SC2012" | ||
| # Expressions don't expand in single quotes, use double quotes for that. | ||
| "SC2016" | ||
| ) | ||
| final_excludes=("${base_excludes[@]}") | ||
| if [ -n "${{ inputs.excluded_codes }}" ]; then | ||
| IFS=',' read -r -a user_excludes <<< "${{ inputs.excluded_codes }}" | ||
| final_excludes+=("${user_excludes[@]}") | ||
| fi | ||
| SHELLCHECK_OPTS="" | ||
| for code in "${final_excludes[@]}"; do | ||
| SHELLCHECK_OPTS+=" -e $code" | ||
| done | ||
|
|
||
| SHELLCHECK_OPTS="${SHELLCHECK_OPTS# }" | ||
|
|
||
| echo "SHELLCHECK_OPTS=$SHELLCHECK_OPTS" >> $GITHUB_ENV | ||
| env: | ||
| GITHUB_ENV: ${{ github.env_path }} | ||
|
|
||
| - name: Run ShellCheck | ||
| uses: ludeeus/action-shellcheck@master | ||
| env: | ||
| SHELLCHECK_OPTS: ${{ env.SHELLCHECK_OPTS }} | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.