-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial workflow job for linting GHA workflows
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
name: Lint Github Actions | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
path: | ||
description: >- | ||
Path to the directory or workflow file to lint. Defaults to the root | ||
of the repo which will detect the default Actions workflow location | ||
at '.github/workflows/' | ||
type: string | ||
default: "." | ||
zizmor-version: | ||
description: >- | ||
Version spec of Zizmor to install. To pin to a specific version use | ||
'==a.b.c', but any vald Pip version specifier can be provided. | ||
type: string | ||
default: ">=1.2,<2.0" | ||
zizmor-options: | ||
description: Additional CLI options to pass to the Zizmor command. | ||
type: string | ||
default: "--min-severity=medium" | ||
secrets: | ||
gh-token: | ||
description: >- | ||
The Github token to use, either provided automatically by the Actions | ||
Runner or manually via a repository/organization secret | ||
required: true | ||
|
||
env: | ||
PYTHON_VERSION: "3.12" | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
lint-actions: | ||
name: Lint:Actions | ||
runs-on: ubuntu-latest | ||
permissions: | ||
security-events: write | ||
contents: read # required for private repositories | ||
actions: read # required for private repositories | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Install python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Install zizmor | ||
run: python -m pip install 'zizmor${{ env.ZIZMOR_VERSION }}' | ||
env: | ||
ZIZMOR_VERSION_SPEC: ${{ inputs.zizmor-version }} | ||
|
||
- name: Lint | ||
run: zizmor ${{ env.ZIZMOR_PATH }} ${{ env.ZIZMOR_OPTIONS }} | ||
env: | ||
GH_TOKEN: ${{ secrets.gh-token }} | ||
ZIZMOR_PATH: ${{ inputs.path }} | ||
ZIZMOR_OPTIONS: ${{ inputs.zizmor-options }} |