Skip to content

Add GitHub Actions workflow for shell script linting and validation#19

Open
Copilot wants to merge 8 commits intomainfrom
copilot/fix-8dcc2d33-3ba3-4ea5-9922-49f5b4064d55
Open

Add GitHub Actions workflow for shell script linting and validation#19
Copilot wants to merge 8 commits intomainfrom
copilot/fix-8dcc2d33-3ba3-4ea5-9922-49f5b4064d55

Conversation

Copy link

Copilot AI commented Sep 25, 2025

This PR adds automated shell script linting and validation to prevent invalid shell commands or syntax from being merged into the repository.

What's Added

A new GitHub Actions workflow (.github/workflows/shell-lint.yml) that automatically:

  • Discovers all *.sh files in the repository using find
  • Runs shellcheck for static analysis and best practice enforcement
  • Validates syntax using bash -n to catch parsing errors
  • Provides clear feedback with success/failure indicators

Workflow Triggers

The workflow runs efficiently on:

  • Pull requests targeting main branch (only when .sh files are modified)
  • Push to main branch (only when .sh files are modified)
  • Manual workflow dispatch for testing purposes

Current Impact

The workflow currently detects existing issues in the repository:

autoupdate-dependencies.sh: 3 shellcheck warnings

  • Missing quotes around variables that could cause word splitting (SC2086)

test/go/test.sh: 1 shellcheck error

  • Missing shebang line (SC2148)

These issues will cause the workflow to fail until resolved, which is the intended behavior to prevent similar problems in future PRs.

Benefits

  • 🛡️ Prevents invalid shell scripts from being merged
  • 🔍 Catches common scripting mistakes early in development
  • 📈 Enforces shell scripting best practices through shellcheck
  • Efficient execution with path-based filtering
  • 🎯 No conflicts with existing workflows (uses unique triggers)

The workflow uses Ubuntu's pre-installed shellcheck and requires no additional dependencies, making it lightweight and reliable.

Original prompt

Add a GitHub Actions workflow to automatically lint and validate Shell scripts (such as autoupdate-dependencies.sh) in pull requests. This should prevent invalid shell commands or syntax from being merged. Use shellcheck for linting and bash -n for syntax validation. The workflow should trigger on pull requests and on push to main, and check all *.sh files in the repository.

*This pull request was created as a result of the following prompt from Copilot chat.* > Add a GitHub Actions workflow to automatically lint and validate Shell scripts (such as autoupdate-dependencies.sh) in pull requests. This should prevent invalid shell commands or syntax from being merged. Use shellcheck for linting and bash -n for syntax validation. The workflow should trigger on pull requests and on push to main, and check all *.sh files in the repository.

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

JackSlateur and others added 6 commits June 28, 2025 12:01
Signed-off-by: Alexandre Bruyelles <git@jack.fr.eu.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
fix(params): improve support for multi-word parameters
Copilot AI and others added 2 commits September 25, 2025 16:19
Co-authored-by: romoh <12943947+romoh@users.noreply.github.com>
Co-authored-by: romoh <12943947+romoh@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Shell script linting and validation workflow for PRs Add GitHub Actions workflow for shell script linting and validation Sep 25, 2025
Copilot AI requested a review from romoh September 25, 2025 16:20
@romoh romoh marked this pull request as ready for review September 25, 2025 17:33
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.

3 participants