Skip to content

Commit bcaacdf

Browse files
Improved README with details and usage guide 🚀
1 parent 2bcd2ec commit bcaacdf

File tree

1 file changed

+111
-2
lines changed

1 file changed

+111
-2
lines changed

README.md

Lines changed: 111 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,111 @@
1-
# shellcheck-scan
2-
Code Scanning GitHub Action wrapper for shellcheck. Add rich support for shellcheck to your CI/CD.
1+
# ShellCheck SARIF Analysis Action
2+
3+
A GitHub Action that generates SARIF analysis results by running ShellCheck on shell scripts
4+
in your repository.
5+
6+
## Overview
7+
8+
This action utilizes ShellCheck (a third-party static analysis tool) to analyze shell scripts
9+
and generates results in SARIF format. The SARIF output integrates with GitHub Code Scanning
10+
to help track shell script quality and potential security issues.
11+
12+
## Features
13+
14+
- 🔍 Leverages ShellCheck for shell script analysis
15+
- 📊 Generates SARIF format output for GitHub Code Scanning
16+
- 🎯 Configurable file matching patterns
17+
- ⚡ Supports multiple shell dialects (Bash, POSIX, Dash, KSH, BusyBox)
18+
- 🔒 Built-in integration with GitHub Security features
19+
20+
## Dependencies
21+
22+
This action depends on:
23+
- [ShellCheck](https://github.com/koalaman/shellcheck) - A static analysis tool for shell scripts
24+
- Python 3.13 (automatically set up by the action)
25+
- SARIF tooling (automatically installed by the action)
26+
27+
## Usage
28+
29+
Add the following to your GitHub Actions workflow:
30+
31+
```yaml
32+
- name: Run ShellCheck Analysis
33+
uses: reactive-firewall/shellcheck-scan@v1
34+
with:
35+
# Optional: Specify paths to scan (defaults to git-tracked shell scripts)
36+
path: 'scripts/'
37+
38+
# Optional: Custom glob pattern for matching files
39+
match: '**/*.{sh,bash,ksh}'
40+
41+
# Optional: Set minimum severity level (style, info, warning, error)
42+
severity: 'warning'
43+
44+
# Optional: Specify shell dialect (bash, sh, dash, ksh, busybox)
45+
shell-format: 'bash'
46+
```
47+
48+
## Inputs
49+
50+
| Input | Description | Required | Default |
51+
|-------|-------------|----------|---------|
52+
| `path` | File or directory to scan | No | Auto-detected |
53+
| `match` | Glob pattern for matching files | No | `**/*.{bash,sh,command}` |
54+
| `severity` | Minimum severity level | No | `style` |
55+
| `shell-format` | Shell dialect to use | No | `AUTOMATIC` |
56+
| `publish-artifacts` | Upload results as artifacts | No | `true` |
57+
58+
## Requirements
59+
60+
This action requires:
61+
- GitHub Actions
62+
- Required permissions:
63+
- `security-events: write` (for uploading SARIF results)
64+
- `contents: read` (for scanning repository contents)
65+
66+
## Examples
67+
68+
### Basic Usage
69+
70+
```yaml
71+
name: ShellCheck Analysis
72+
73+
on: [push, pull_request]
74+
75+
jobs:
76+
shellcheck:
77+
runs-on: ubuntu-latest
78+
permissions:
79+
security-events: write
80+
contents: read
81+
steps:
82+
- uses: actions/checkout@v4
83+
- uses: reactive-firewall/shellcheck-scan@v1
84+
```
85+
86+
### Custom Configuration
87+
88+
```yaml
89+
- uses: reactive-firewall/shellcheck-scan@v1
90+
with:
91+
path: 'scripts/'
92+
severity: 'warning'
93+
shell-format: 'bash'
94+
match: '**/*.bash'
95+
```
96+
97+
## License
98+
99+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE)
100+
file for details.
101+
102+
## Contributing
103+
104+
Contributions are welcome! Please feel free to submit a Pull Request.
105+
106+
## Support
107+
108+
If you encounter any problems, please file an issue along with a detailed description.
109+
110+
---
111+
Last Updated: 2024-12-21

0 commit comments

Comments
 (0)