Skip to content

Commit a30be53

Browse files
feat: switch to pipx & add github-token (#23)
## πŸ’Œ Description - switch to pipx for deps install - deprecate `token` in favor of `github-token` - prep for v2 ## πŸ”— Related issue <!-- If your PR refers to a related issue, link it here. --> Fixes: #21 ## πŸ—οΈ Type of change <!-- Mark with an `x` all the checkboxes that apply (like `[x]`) --> - [ ] πŸ“š Examples/docs/tutorials - [ ] πŸ› Bug fix (non-breaking change which fixes an issue) - [ ] πŸ₯‚ Improvement (non-breaking change which improves an existing feature) - [ ] πŸš€ New feature (non-breaking change which adds functionality) - [ ] πŸ’₯ Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🚨 Security fix - [ ] ⬆️ Dependencies update ## βœ… Checklist <!-- Mark with an `x` all the checkboxes that apply (like `[x]`) --> - [ ] I've read the [`Code of Conduct`](https://github.com/raven-actions/actionlint/blob/main/.github/CODE_OF_CONDUCT.md) document. - [ ] I've read the [`Contributing`](https://github.com/raven-actions/actionlint/blob/main/.github/CONTRIBUTING.md) guide.
1 parent ea4eb57 commit a30be53

File tree

3 files changed

+33
-24
lines changed

3 files changed

+33
-24
lines changed

β€Ž.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
# files: .pre-commit-config.yaml
1313

1414
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.5.0
15+
rev: v4.6.0
1616
hooks:
1717
- id: check-symlinks
1818
- id: trailing-whitespace
@@ -40,7 +40,7 @@ repos:
4040
exclude: package-lock.json
4141

4242
- repo: https://github.com/gitleaks/gitleaks
43-
rev: v8.18.0
43+
rev: v8.18.4
4444
hooks:
4545
- id: gitleaks
4646
args:

β€ŽREADME.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This [GitHub Action](https://github.com/features/actions) allows you to quickly
99

1010
- Action is platform-independent and tested on all the latest GitHub-hosted runners (`ubuntu-latest`, `macos-latest`, `windows-latest`).
1111
- Uses [GitHub cache](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows) for caching `actionlint` binaries for faster and more efficient workflow run.
12-
- 3rd party `actionlint` dependencies like `shellcheck` or `pyflakes` are not cached, but action installs them if not present on the Runner.
12+
- 3rd party `actionlint` dependencies like `shellcheck` or `pyflakes` are not cached, but action installs them if not present on the GitHub Runner using [pipx](https://pipx.pypa.io/) (make sure your GitHub Runner has it).
1313

1414
![demo-error](https://raw.githubusercontent.com/raven-actions/actionlint/main/assets/images/demo-error.png)
1515

@@ -33,7 +33,7 @@ Just place in your GitHub workflow steps:
3333

3434
```yaml
3535
- name: actionlint
36-
uses: raven-actions/actionlint@v1
36+
uses: raven-actions/actionlint@v2
3737
```
3838
3939
### Customization
@@ -45,7 +45,7 @@ Action returns some basic information. For more details, follow [πŸ“€ Outputs](#
4545
```yaml
4646
- name: actionlint
4747
id: actionlint #optional, id required only when outputs are used in the workflow steps later
48-
uses: raven-actions/actionlint@v1
48+
uses: raven-actions/actionlint@v2
4949
with:
5050
matcher: false # optional
5151
cache: false # optional
@@ -68,17 +68,18 @@ Action returns some basic information. For more details, follow [πŸ“€ Outputs](#
6868
6969
## πŸ“₯ Inputs
7070
71-
| Name | Required | Type | Default value | Description |
72-
| :-------------: | :------: | :------: | :-----------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------- |
73-
| `version` | false | `string` | `latest` | SemVer version of `actionlint`, recommended to keep default: latest |
74-
| `matcher` | false | `bool` | `true` | Use matcher for GitHub annotations |
75-
| `files` | false | `string` | *not set* | To lint different workflow files (default searching directory is `.github/workflows`), use comma-separated glob patterns, e.g., `tests/*.yml, tests/*.yaml` |
76-
| `flags` | false | `string` | *not set* | Extra flags to use with `actionlint` |
77-
| `group-result` | false | `bool` | `true` | Use the GitHub log grouping feature for failure actionlint results. |
78-
| `fail-on-error` | false | `bool` | `true` | Fail action on `actionlint` errors |
79-
| `shellcheck` | false | `bool` | `true` | Use `shellcheck` with `actionlint` (and install if it does not exist) |
80-
| `pyflakes` | false | `bool` | `true` | Use `pyflakes` with `actionlint` (and install if it does not exist) |
81-
| `cache` | false | `bool` | `true` | Use GitHub cache for caching binaries for the next runs |
71+
| Name | Required | Type | Default value | Description |
72+
| :--------------: | :------: | :------: | :--------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------- |
73+
| `version` | false | `string` | `latest` | SemVer version of `actionlint`, recommended to keep default: `latest` |
74+
| `matcher` | false | `bool` | `true` | Use matcher for GitHub annotations. |
75+
| `files` | false | `string` | _not set_ | To lint different workflow files (default searching directory is `.github/workflows`), use comma-separated glob patterns, e.g., `tests/*.yml, tests/*.yaml` |
76+
| `flags` | false | `string` | _not set_ | Extra flags to use with `actionlint` |
77+
| `group-result` | false | `bool` | `true` | Use the GitHub log grouping feature for failure actionlint results. |
78+
| `fail-on-error` | false | `bool` | `true` | Fail action on `actionlint` errors. |
79+
| `shellcheck` | false | `bool` | `true` | Use `shellcheck` with `actionlint` (and install if it does not exist) |
80+
| `pyflakes` | false | `bool` | `true` | Use `pyflakes` with `actionlint` (and install if it does not exist) |
81+
| `cache` | false | `bool` | `true` | Use GitHub cache for caching binaries for the next runs. |
82+
| `github-token` | false | `string` | `github.token` | GitHub Token for API authentication. |
8283

8384
## πŸ“€ Outputs
8485

β€Žaction.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
---
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
22
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
3+
---
34
name: actionlint
45
description: βœ… Run actionlint for validating your GitHub Actions workflow files.
56
author: Dariusz Porowski
@@ -56,6 +57,11 @@ inputs:
5657
description: GitHub Token
5758
required: false
5859
default: ${{ github.token }}
60+
deprecationMessage: Use `github-token` input instead
61+
github-token:
62+
description: GitHub Token
63+
required: false
64+
default: ${{ github.token }}
5965
outputs:
6066
version-semver:
6167
description: SemVer version
@@ -86,7 +92,7 @@ runs:
8692
uses: actions/github-script@v7
8793
id: environment
8894
with:
89-
github-token: ${{ inputs.token || env.GITHUB_TOKEN }}
95+
github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }}
9096
script: |
9197
// input envs
9298
const { INPUT_TOOL_NAME, INPUT_TOOL_SEMVER, INPUT_REPO_OWNER, INPUT_REPO_NAME, RUNNER_TEMP } = process.env
@@ -202,10 +208,11 @@ runs:
202208
shell: ${{ (runner.os == 'Windows' && 'pwsh') || 'bash' }}
203209
working-directory: ${{ inputs.working-directory }}
204210

205-
- uses: actions/github-script@v7
211+
- name: Download tool
212+
uses: actions/github-script@v7
206213
if: ${{ steps.tool-cache.outputs.cache-hit != 'true' }}
207214
with:
208-
github-token: ${{ inputs.token || env.GITHUB_TOKEN }}
215+
github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }}
209216
script: |
210217
// dependencies
211218
const tc = require('@actions/tool-cache')
@@ -242,7 +249,7 @@ runs:
242249
if: ${{ inputs.pyflakes == 'true' || inputs.shellcheck == 'true' }}
243250
id: tool-dependencies
244251
with:
245-
github-token: ${{ inputs.token || env.GITHUB_TOKEN }}
252+
github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }}
246253
script: |
247254
// input envs
248255
const { INPUT_PYFLAKES, INPUT_SHELLCHECK } = process.env
@@ -268,7 +275,7 @@ runs:
268275
core.debug(`${pyflakesBinary} exists: ${pyflakesExists}`)
269276
270277
if (pyflakesExists === false) {
271-
await exec.exec('python3', ['-m', 'pip', 'install', '--upgrade', 'pyflakes'])
278+
await exec.exec('pipx', ['install', 'pyflakes'])
272279
}
273280
}
274281
@@ -303,10 +310,11 @@ runs:
303310
INPUT_PYFLAKES: ${{ inputs.pyflakes }}
304311
INPUT_SHELLCHECK: ${{ inputs.shellcheck }}
305312

306-
- uses: actions/github-script@v7
313+
- name: Run tool
314+
uses: actions/github-script@v7
307315
id: tool-runner
308316
with:
309-
github-token: ${{ inputs.token || env.GITHUB_TOKEN }}
317+
github-token: ${{ inputs.github-token || inputs.token || env.GITHUB_TOKEN }}
310318
script: |
311319
// input envs
312320
const { INPUT_FILES, INPUT_FLAGS, INPUT_TOOL_NAME, INPUT_TOOL_DIR_PATH, INPUT_MATCHER, INPUT_MATCHER_PATH, INPUT_TOOL_EXECUTABLE, INPUT_JSON, INPUT_FAIL_ON_ERROR, INPUT_PYFLAKES, INPUT_SHELLCHECK, INPUT_GROUP_RESULT, DEBUG } = process.env

0 commit comments

Comments
Β (0)