-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add option to skip downloading shellcheck on every run #108
base: master
Are you sure you want to change the base?
Conversation
With special `version: system` action input value, this will skip downloading shellcheck from GitHub on every run and instead use the shellcheck version that comes preinstalled in GitHub Actions runner images. When shellcheck is downloaded, it is extracted into a temporary directory (as opposed to `github.action_path`) which is then added to PATH.
📝 WalkthroughWalkthroughThe changes in this pull request involve updates to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GitHub Action
participant ShellCheck
User->>GitHub Action: Trigger action
GitHub Action->>ShellCheck: Check INPUT_VERSION
alt version is 'system'
ShellCheck-->>GitHub Action: Use pre-installed ShellCheck
else version specified
GitHub Action->>ShellCheck: Download specified version
ShellCheck-->>GitHub Action: Return ShellCheck executable
end
GitHub Action->>ShellCheck: Execute ShellCheck
ShellCheck-->>GitHub Action: Return results
GitHub Action-->>User: Output results
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai full review |
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.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (2)
- README.md (2 hunks)
- action.yaml (3 hunks)
🔇 Additional comments (6)
README.md (2)
Line range hint
160-169
: LGTM! Clear and well-structured documentation update.The documentation clearly explains the version specification options and maintains consistency with the existing format.
170-170
: LGTM! Clear documentation of the new feature.The documentation effectively communicates the new
version: system
option and includes an important note about potential version differences. The link to runner images is helpful for users to verify the pre-installed version.action.yaml (4)
44-44
: LGTM! Clear and well-documented input description.The description effectively communicates the new 'system' option while maintaining backward compatibility.
87-87
: LGTM! Simplified version display.The command is correctly simplified since shellcheck is now available in PATH.
211-216
: LGTM! Consistent simplification of shellcheck execution.The execution commands are correctly simplified while maintaining the same functionality.
64-82
: Verify system shellcheck functionality.Let's ensure the system shellcheck option works as expected across different runner environments.
✅ Verification successful
System shellcheck functionality verified successfully
The system shellcheck is available and functional in the runner environment with version 0.9.0 installed. This confirms that the
system
option in the action will work as expected, allowing users to utilize the pre-installed shellcheck version.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify system shellcheck availability and version across different runner environments # Test: Check if shellcheck is pre-installed on the runner if ! command -v shellcheck &> /dev/null; then echo "::warning::shellcheck not found in PATH" exit 1 fi # Test: Get shellcheck version for documentation shellcheck --versionLength of output: 184
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/${INPUT_VERSION}/shellcheck-${INPUT_VERSION}.${osvariant}.x86_64.tar.xz" | \ | ||
tar -xz -C "${download_dir}" --strip-components 1 -- "shellcheck-${INPUT_VERSION}/shellcheck" | ||
|
||
tar -xf "${{ github.action_path }}/sc.tar.xz" -C "${{ github.action_path }}" | ||
mv "${{ github.action_path }}/shellcheck-${INPUT_VERSION}/shellcheck" \ | ||
"${{ github.action_path }}/shellcheck" | ||
echo "${download_dir}" >> "$GITHUB_PATH" |
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.
Verify shellcheck binary after extraction.
The download and extraction should be verified to ensure we have a working shellcheck binary.
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/${INPUT_VERSION}/shellcheck-${INPUT_VERSION}.${osvariant}.x86_64.tar.xz" | \
tar -xz -C "${download_dir}" --strip-components 1 -- "shellcheck-${INPUT_VERSION}/shellcheck"
+if [ ! -x "${download_dir}/shellcheck" ]; then
+ echo "::error::Failed to download or extract shellcheck"
+ exit 1
+fi
+
echo "${download_dir}" >> "$GITHUB_PATH"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/${INPUT_VERSION}/shellcheck-${INPUT_VERSION}.${osvariant}.x86_64.tar.xz" | \ | |
tar -xz -C "${download_dir}" --strip-components 1 -- "shellcheck-${INPUT_VERSION}/shellcheck" | |
tar -xf "${{ github.action_path }}/sc.tar.xz" -C "${{ github.action_path }}" | |
mv "${{ github.action_path }}/shellcheck-${INPUT_VERSION}/shellcheck" \ | |
"${{ github.action_path }}/shellcheck" | |
echo "${download_dir}" >> "$GITHUB_PATH" | |
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/${INPUT_VERSION}/shellcheck-${INPUT_VERSION}.${osvariant}.x86_64.tar.xz" | \ | |
tar -xz -C "${download_dir}" --strip-components 1 -- "shellcheck-${INPUT_VERSION}/shellcheck" | |
if [ ! -x "${download_dir}/shellcheck" ]; then | |
echo "::error::Failed to download or extract shellcheck" | |
exit 1 | |
fi | |
echo "${download_dir}" >> "$GITHUB_PATH" |
When reviewing this action, I was surprised that it downloads shellcheck on every run even though shellcheck comes pre-installed with GitHub Actions runner images.
With special
version: system
action input value, this will skip downloading shellcheck from GitHub on every run and instead use the shellcheck version that comes preinstalled. This is an alternative approach to #100Otherwise, when shellcheck is downloaded, it is extracted into a temporary directory (as opposed to
github.action_path
) which is then added to PATH.