jactionlint 2.2.0__py3-none-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jactionlint/__init__.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Go binary packaged as Python wheel."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import stat
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
__version__ = "2.2.0"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_binary_path():
|
|
12
|
+
"""Return the path to the bundled binary."""
|
|
13
|
+
binary = os.path.join(os.path.dirname(__file__), "bin", "jactionlint.exe")
|
|
14
|
+
|
|
15
|
+
# Ensure binary is executable on Unix
|
|
16
|
+
if sys.platform != "win32":
|
|
17
|
+
current_mode = os.stat(binary).st_mode
|
|
18
|
+
if not (current_mode & stat.S_IXUSR):
|
|
19
|
+
os.chmod(binary, current_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
|
20
|
+
|
|
21
|
+
return binary
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def main():
|
|
25
|
+
"""Execute the bundled binary."""
|
|
26
|
+
binary = get_binary_path()
|
|
27
|
+
|
|
28
|
+
if sys.platform == "win32":
|
|
29
|
+
# On Windows, use subprocess to properly handle signals
|
|
30
|
+
sys.exit(subprocess.call([binary] + sys.argv[1:]))
|
|
31
|
+
else:
|
|
32
|
+
# On Unix, exec replaces the process
|
|
33
|
+
os.execvp(binary, [binary] + sys.argv[1:])
|
jactionlint/__main__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: jactionlint
|
|
3
|
+
Version: 2.2.0
|
|
4
|
+
Summary: Static checker for GitHub Actions workflow files
|
|
5
|
+
License: MIT
|
|
6
|
+
Home-page: https://github.com/jdx/jactionlint
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# jactionlint
|
|
11
|
+
|
|
12
|
+
[](https://github.com/jdx/jactionlint/actions/workflows/ci.yaml)
|
|
13
|
+
[](https://pkg.go.dev/github.com/jdx/jactionlint/v2)
|
|
14
|
+
|
|
15
|
+
jactionlint is a static checker for GitHub Actions workflow files, composite actions and `dependabot.yml`. It is a fork of [rhysd/actionlint](https://github.com/rhysd/actionlint) that merges the pull requests of upstream and adds security and policy checks, automatic fixes and a baseline. Try it in the [playground](https://jactionlint.jdx.dev/playground) without installing anything.
|
|
16
|
+
|
|
17
|
+
## What it checks
|
|
18
|
+
|
|
19
|
+
- [Syntax and schema](https://jactionlint.jdx.dev/checks#check-unexpected-keys): unexpected or missing keys, event names, glob patterns, runner labels, cron syntax and `needs:` dependencies.
|
|
20
|
+
- [Typed expressions](https://jactionlint.jdx.dev/checks#check-type-check-expression): `${{ }}` expressions are type-checked, so an unknown property or a type mismatch is a finding.
|
|
21
|
+
- [Action inputs](https://jactionlint.jdx.dev/checks#check-popular-action-inputs) and [reusable workflows](https://jactionlint.jdx.dev/checks#check-reusable-workflows): the `with:` inputs and `steps.<id>.outputs` of actions, and the inputs, outputs and secrets of reusable workflows.
|
|
22
|
+
- [Scripts](https://jactionlint.jdx.dev/checks#check-shellcheck-integ): the shell scripts of `run:` go through shellcheck and the Python scripts (`shell: python`) through pyflakes, which you install yourself.
|
|
23
|
+
- [Security and policy](https://jactionlint.jdx.dev/rules): untrusted input in scripts, unpinned actions, excessive permissions, dangerous triggers, cache poisoning, hard-coded credentials and missing timeouts. [jactionlint and zizmor](https://jactionlint.jdx.dev/zizmor-parity) compares these rules with zizmor.
|
|
24
|
+
- [Online checks](https://jactionlint.jdx.dev/online): opt-in checks of the actions a workflow uses against the GitHub API. Without them, jactionlint does not use the network.
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
Save this workflow as `test.yaml`. It has a typo in a trigger, an untrusted value in a script, an undefined matrix property, an unpinned action, and no permissions, timeout or concurrency group:
|
|
29
|
+
|
|
30
|
+
<!-- demo:input -->
|
|
31
|
+
```yaml
|
|
32
|
+
on:
|
|
33
|
+
push:
|
|
34
|
+
branch: main
|
|
35
|
+
jobs:
|
|
36
|
+
test:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- run: echo "${{ github.event.head_commit.message }}"
|
|
41
|
+
- run: echo "${{ matrix.os }}"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Run `jactionlint test.yaml`. The default profile, which applies when you configure nothing, reports these findings (without colors):
|
|
45
|
+
|
|
46
|
+
<!-- demo:output -->
|
|
47
|
+
```
|
|
48
|
+
test.yaml:1:1: workflow has no "concurrency:", so every run of it executes at the same time even when a newer run supersedes the older ones. add a top-level "concurrency:" with a "group:" and "cancel-in-progress: true" [concurrency-limits]
|
|
49
|
+
|
|
|
50
|
+
1 | on:
|
|
51
|
+
| ^~~
|
|
52
|
+
test.yaml:3:5: unexpected key "branch" for "push" section. expected one of "branches", "branches-ignore", "paths", "paths-ignore", "tags", "tags-ignore", "types", "workflows" [workflow-syntax]
|
|
53
|
+
|
|
|
54
|
+
3 | branch: main
|
|
55
|
+
| ^~~~~~~
|
|
56
|
+
test.yaml:5:3: "timeout-minutes" is not set at this job. Set it to avoid wasting runner minutes when the job hangs. Set "default-minutes" in the "missing-timeout" rule options of the configuration to turn on the --fix fix [missing-timeout]
|
|
57
|
+
|
|
|
58
|
+
5 | test:
|
|
59
|
+
| ^~~~~
|
|
60
|
+
test.yaml:5:3: neither the workflow nor this job sets "permissions:" so the GITHUB_TOKEN gets the default permissions of the repository. set "permissions:" at workflow-level or job-level (use "permissions: {}" for no permissions) because the "missing-permissions" rule is enabled [missing-permissions]
|
|
61
|
+
|
|
|
62
|
+
5 | test:
|
|
63
|
+
| ^~~~~
|
|
64
|
+
test.yaml:8:15: action "actions/checkout@v4" must be pinned to a full-length commit SHA like "{owner}/{repo}@{sha}" because the "unpinned-uses" rule is enabled [unpinned-uses]
|
|
65
|
+
|
|
|
66
|
+
8 | - uses: actions/checkout@v4
|
|
67
|
+
| ^~~~~~~~~~~~~~~~~~~
|
|
68
|
+
test.yaml:8:15: actions/checkout leaves the GITHUB_TOKEN in the git config of the workspace, where a later step such as an artifact upload can publish it. set "persist-credentials: false" under "with:" unless a later step needs to push [artipacked]
|
|
69
|
+
|
|
|
70
|
+
8 | - uses: actions/checkout@v4
|
|
71
|
+
| ^~~~~~~~~~~~~~~~~~~
|
|
72
|
+
test.yaml:9:24: "github.event.head_commit.message" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks for more details [template-injection]
|
|
73
|
+
|
|
|
74
|
+
9 | - run: echo "${{ github.event.head_commit.message }}"
|
|
75
|
+
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
76
|
+
test.yaml:10:24: property "os" is not defined in object type {} [undefined-property]
|
|
77
|
+
|
|
|
78
|
+
10 | - run: echo "${{ matrix.os }}"
|
|
79
|
+
| ^~~~~~~~~
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`jactionlint --profile correctness test.yaml` reports only `workflow-syntax`, `template-injection` and `undefined-property`. `jactionlint --diff test.yaml` prints the safe fixes of `artipacked`, `missing-permissions` and `template-injection` as a diff and writes nothing. The [playground](https://jactionlint.jdx.dev/playground) turns off the default rules that a minimal example breaks, so it reports the findings of the `correctness` profile for this workflow.
|
|
83
|
+
|
|
84
|
+
<a id="quick-start"></a>
|
|
85
|
+
## Install
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
mise use -g jactionlint
|
|
89
|
+
jactionlint --version
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Without `-g`, `mise use jactionlint` records the tool in the `mise.toml` of the current project. The other methods:
|
|
93
|
+
|
|
94
|
+
- Download an archive for your platform from the [releases](https://github.com/jdx/jactionlint/releases). It holds the executable, the man page and the docs.
|
|
95
|
+
- Install the Homebrew cask: `brew tap jdx/jactionlint https://github.com/jdx/jactionlint`, then `brew install --cask jdx/jactionlint/jactionlint`.
|
|
96
|
+
- Run the [download script](https://jactionlint.jdx.dev/install#download-script), which downloads the archive of your platform and extracts the executable. It does not verify the archive.
|
|
97
|
+
- Pull the Docker image `ghcr.io/jdx/jactionlint`, which also holds shellcheck and pyflakes.
|
|
98
|
+
- Build it with Go: `go install github.com/jdx/jactionlint/v2/cmd/jactionlint@latest`.
|
|
99
|
+
|
|
100
|
+
Distribution packages named `actionlint` install the original project, not this fork. These docs describe the main branch: `jactionlint --help` shows what the installed version supports. [Installation](https://jactionlint.jdx.dev/install) has the details and how to verify a download.
|
|
101
|
+
|
|
102
|
+
## Run it
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
jactionlint
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
With no arguments, jactionlint checks the workflows, composite actions, `dependabot.yml` and Actions lock file of the repository ([what a run checks](https://jactionlint.jdx.dev/usage#what-a-run-checks)). Run it in a Git or Jujutsu repository that has a `.github/workflows` directory: outside a repository it exits with status 3. Pass file names to check only those, wherever they are (for example the `test.yaml` above), or `-` to read standard input.
|
|
109
|
+
|
|
110
|
+
- The exit status is `0` for success, `1` when a finding of level `error` is left, `2` for an invalid command line and `3` for a failure. [Exit status](https://jactionlint.jdx.dev/cli#exit-status) lists every cause.
|
|
111
|
+
- The name in brackets at the end of a finding is its rule ID. `jactionlint --explain unpinned-uses` prints what the rule checks, its group, profile, level, options and fix. These pages describe the development version, so a release can lack an option such as `--explain`: when `jactionlint --help` of your install does not list an option, [build the main branch](https://jactionlint.jdx.dev/install#build-from-source) with `go install github.com/jdx/jactionlint/v2/cmd/jactionlint@main`.
|
|
112
|
+
- To silence a finding you accept, put `# jactionlint ignore=unpinned-uses` on the line above it ([Ignore findings](https://jactionlint.jdx.dev/ignore)).
|
|
113
|
+
- shellcheck and pyflakes are separate programs. When one is missing, jactionlint prints a note and skips the scripts it would have checked, and the missing program does not fail the run.
|
|
114
|
+
- `jactionlint --init-config` writes `.github/jactionlint.yaml` ([Configuration](https://jactionlint.jdx.dev/config)).
|
|
115
|
+
|
|
116
|
+
<a id="choose-how-much-is-checked"></a>
|
|
117
|
+
## Choose a profile
|
|
118
|
+
|
|
119
|
+
| Profile | Checks |
|
|
120
|
+
| ------- | ------ |
|
|
121
|
+
| `correctness` | What actionlint checks and the bug detectors of jactionlint. It has almost no security posture or policy rules. |
|
|
122
|
+
| `default` | `correctness` plus the security and policy rules worth failing a build on. It applies when you configure nothing. |
|
|
123
|
+
| `pedantic` | `default` plus the noisy and opinionated rules. |
|
|
124
|
+
|
|
125
|
+
Choose a profile with `--profile` or with `profile:` in the config file. The default profile can fail on the first run in a repository that never followed it. When a text run on a terminal or in CI reports many findings and applies no baseline, jactionlint prints a hint about the baseline; `--no-hints` turns it off.
|
|
126
|
+
|
|
127
|
+
To adopt the default profile step by step, fix what `--profile correctness` reports first, because those findings are mistakes and not debt to record. Then record the findings that are left and apply the record. A plain run applies the baseline only when the config file sets `baseline: auto`; `--baseline` applies it to one run.
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
# the checks of actionlint plus the bug detectors: fix what this reports first
|
|
131
|
+
jactionlint --profile correctness
|
|
132
|
+
|
|
133
|
+
# then record the findings of the default profile that are left, and apply the record
|
|
134
|
+
jactionlint --baseline-write
|
|
135
|
+
jactionlint --baseline
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
See [Profiles](https://jactionlint.jdx.dev/config#profiles), [Adopt new checks with a baseline](https://jactionlint.jdx.dev/baseline#write-and-apply-the-baseline), [Coming from actionlint](https://jactionlint.jdx.dev/actionlint) and [Migrating to v2](https://jactionlint.jdx.dev/v2-migration).
|
|
139
|
+
|
|
140
|
+
<a id="in-ci-with-mise"></a>
|
|
141
|
+
## Use it in CI
|
|
142
|
+
|
|
143
|
+
[`jdx/mise-action`](https://github.com/jdx/mise-action) installs the tools of the `mise.toml` of the repository, so add jactionlint with `mise use jactionlint` first. The step fails on a finding of level `error`. This workflow reports nothing under the default profile:
|
|
144
|
+
|
|
145
|
+
```yaml
|
|
146
|
+
name: Lint GitHub Actions workflows
|
|
147
|
+
on:
|
|
148
|
+
push:
|
|
149
|
+
branches: [main]
|
|
150
|
+
pull_request:
|
|
151
|
+
permissions: {}
|
|
152
|
+
concurrency:
|
|
153
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
154
|
+
cancel-in-progress: true
|
|
155
|
+
jobs:
|
|
156
|
+
jactionlint:
|
|
157
|
+
runs-on: ubuntu-latest
|
|
158
|
+
timeout-minutes: 10
|
|
159
|
+
permissions:
|
|
160
|
+
contents: read
|
|
161
|
+
steps:
|
|
162
|
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
|
163
|
+
with:
|
|
164
|
+
persist-credentials: false
|
|
165
|
+
- uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
|
|
166
|
+
- run: jactionlint
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
[Run jactionlint in CI](https://jactionlint.jdx.dev/ci#the-action) also covers the jactionlint action, which annotates pull requests or reports to code scanning, the [Docker image](https://jactionlint.jdx.dev/ci#docker) and [problem matchers](https://jactionlint.jdx.dev/ci#problem-matchers). [Git hooks and editors](https://jactionlint.jdx.dev/hooks) covers [hk](https://jactionlint.jdx.dev/hooks#hk) and [pre-commit](https://jactionlint.jdx.dev/hooks#pre-commit).
|
|
170
|
+
|
|
171
|
+
<a id="documents"></a>
|
|
172
|
+
## Documentation
|
|
173
|
+
|
|
174
|
+
The site [jactionlint.jdx.dev](https://jactionlint.jdx.dev) renders the pages in `docs/`, and the release archives hold the same files. Start with these pages:
|
|
175
|
+
|
|
176
|
+
| Page | Read it when |
|
|
177
|
+
| ---- | ------------ |
|
|
178
|
+
| [Installation](https://jactionlint.jdx.dev/install) | you choose how to install jactionlint (mise, Homebrew, a release archive, the download script, Docker or Go) and check that it works. |
|
|
179
|
+
| [Run jactionlint](https://jactionlint.jdx.dev/usage) | you run jactionlint on a repository, files or stdin, choose a profile, explain a rule or set up shellcheck, pyflakes and completion. |
|
|
180
|
+
| [Ignore findings](https://jactionlint.jdx.dev/ignore) | you accept a finding and silence it with a comment, an option, the config file or a zizmor comment. |
|
|
181
|
+
| [Adopt new checks with a baseline](https://jactionlint.jdx.dev/baseline) | you adopt a stricter profile before everything is fixed: record a baseline so that only new findings fail. |
|
|
182
|
+
| [Run jactionlint in CI](https://jactionlint.jdx.dev/ci) | you run jactionlint on GitHub Actions with the action, mise, Docker or the download script and show findings as annotations or code scanning alerts. |
|
|
183
|
+
| [Configuration](https://jactionlint.jdx.dev/config) | you create `.github/jactionlint.yaml` or look up a key, a profile or the level of a rule. |
|
|
184
|
+
| [Checks](https://jactionlint.jdx.dev/checks) | you hold a finding or a rule ID and want to know what is checked, with an example and the fix. |
|
|
185
|
+
|
|
186
|
+
The full list of pages is in [docs/README.md](docs/README.md).
|
|
187
|
+
|
|
188
|
+
<a id="bug-reporting"></a>
|
|
189
|
+
## Contributing and bugs
|
|
190
|
+
|
|
191
|
+
To report a bug, a false positive or an idea for a check, [open an issue](https://github.com/jdx/jactionlint/issues/new) with a minimal workflow that shows it. [CONTRIBUTING.md](CONTRIBUTING.md) explains how to build and test jactionlint and how to propose a change.
|
|
192
|
+
|
|
193
|
+
<a id="license"></a>
|
|
194
|
+
## License and acknowledgments
|
|
195
|
+
|
|
196
|
+
jactionlint is distributed under the [MIT license](LICENSE.txt). [NOTICE.md](NOTICE.md) names the projects it builds on, including actionlint, zizmor and ghlint.
|
|
197
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
jactionlint/__init__.py,sha256=WxFREj0nHWWQEDeqy4rgqV0J8xvwowH-R3PVw8iuLkE,890
|
|
2
|
+
jactionlint/__main__.py,sha256=IvTjTYhvVO6h9Jpa45i-FfzjcKcJy1jwkAZY_CkgibQ,26
|
|
3
|
+
jactionlint/bin/jactionlint.exe,sha256=UYvFH4xjgnhF9k9dSDSgiqPN5nuhr0vWPOgwtLDVBRE,16270336
|
|
4
|
+
jactionlint-2.2.0.dist-info/METADATA,sha256=ixb0Ja9gvwtK2bLbA4IpoI5ehA53zxDJBIu6qoGS_pw,13615
|
|
5
|
+
jactionlint-2.2.0.dist-info/WHEEL,sha256=RM2yzFWRquAEAXaVsUwfb9bWleCWQAapuqMXyIhwCUI,95
|
|
6
|
+
jactionlint-2.2.0.dist-info/entry_points.txt,sha256=ljUHDl2cEzUzf5yR15OKCwduzM_wSeLYDjH8zgP4n3I,49
|
|
7
|
+
jactionlint-2.2.0.dist-info/RECORD,,
|