forked from rdmorganiser/.github
-
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.
ci: set up reusable _lint workflow (rdmorganiser#13)
Fixes rdmorganiser#9
- Loading branch information
1 parent
b64267b
commit 1b5eb3b
Showing
3 changed files
with
90 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,33 @@ | ||
# This is a reusable workflow. | ||
# | ||
# Usage: Use the workflow in calling workflows like this: | ||
# "uses: rdmorganiser/.github/.github/workflows/_lint.yml@main" | ||
# Pin it to a branch, tag or commit hash. | ||
# | ||
# Ref: https://docs.github.com/en/actions/using-workflows/reusing-workflows | ||
|
||
name: Lint | ||
|
||
on: | ||
workflow_call: # reusable workflow | ||
|
||
permissions: {} # Set permissions at the job level | ||
|
||
env: | ||
PYTHONDONTWRITEBYTECODE: 1 | ||
FORCE_COLOR: 1 # enforce colored output | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
- name: Run linters via pre-commit (e.g. typos) | ||
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | ||
with: | ||
extra_args: --all-files --color=always |
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,19 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: # run manually from actions tab | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: {} # Set permissions at the job level | ||
|
||
jobs: | ||
|
||
lint: | ||
uses: ./.github/workflows/_lint.yml |
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,38 @@ | ||
# pre-commit | ||
# Ref: https://pre-commit.com/#usage | ||
# More hooks: https://pre-commit.com/hooks.html | ||
# ------------------------------------------------------------------------------ | ||
|
||
repos: | ||
|
||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
|
||
# Check all files for generic issues, e.g. trailing whitespace | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
|
||
# Pretty-format YAML files | ||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks | ||
rev: v2.13.0 | ||
hooks: | ||
- id: pretty-format-yaml | ||
args: [--autofix, --indent, '2'] | ||
|
||
# Check JSON Schema | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.29.0 | ||
hooks: | ||
- id: check-dependabot | ||
- id: check-github-workflows | ||
|
||
# Check for typos | ||
- repo: https://github.com/crate-ci/typos | ||
rev: v1.23.2 | ||
hooks: | ||
- id: typos |