Reusable workflow that performs linting on the codebase. Executes:
- Super-Linter, with some opinionated defaults.
- CodeQL to analyze the code.
- Ratchet to check that GitHub Action versions are pinned.
name: "Linter"
on:
push:
branches: [main]
tags: ["*"]
pull_request:
branches: [main]
permissions:
contents: read
statuses: write
jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/[email protected]
with:
# Json array of runner(s) to use.
# See <https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job>.
runs-on: '["ubuntu-latest"]'
# Environment variables in multilines format "key=value" to pass to the linter.
# See <https://github.com/super-linter/super-linter>.
linter-env: ""
# JSON array of languages to analyze with CodeQL.
# See <https://codeql.github.com/docs/codeql-overview/supported-languages-and-frameworks/>.
# Leave empty to disable the check.
codeql-languages: '["actions"]'
# List of files or directories where GitHub Actions and workflows are located.
# Supports glob patterns.
# Leave empty to disable the check.
action-files: |
./action.yml
./.github/workflows/**/*.yml
./actions/**/*.yml
# Run checks on all files, not just the changed ones.
lint-all: ${{ github.event_name != 'pull_request' }}
secrets:
# Token for marking the status of linter run in the Checks section.
# See https://github.com/super-linter/super-linter#how-to-use
# Default GITHUB_TOKEN.
github-token: ""
Secret | Description | Default | Required |
---|---|---|---|
github-token |
Token for marking the status of linter run in the Checks section. See https://github.com/super-linter/super-linter#how-to-use. | GITHUB_TOKEN |
false |
Input | Description | Default | Type | Required |
---|---|---|---|---|
runs-on |
Json array of runner(s) to use. See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job. | ["ubuntu-latest"] |
string |
false |
linter-env |
Environment variables in multilines format "key=value" to pass to the linter. See https://github.com/super-linter/super-linter. | .github/workflows\nactions |
string |
false |
codeql-languages |
JSON array of languages to analyze with CodeQL. See https://codeql.github.com/docs/codeql-overview/supported-languages-and-frameworks/. Leave empty to disable the check. | ["actions"] |
string |
false |
action-files |
List of files or directories where GitHub Actions and workflows are located. Supports glob patterns. Leave empty to disable the check. | ./action.yml\n./.github/workflows/**/*.yml\n./actions/**/*.yml |
string |
false |
lint-all |
Run linter on all files, not just the changed ones. | github.event_name != 'pull_request' |
boolean |
false |