Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/self-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint:
uses: validatedpatterns/github-actions-library/.github/workflows/superlinter.yml@v1
18 changes: 8 additions & 10 deletions .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ on:
required: false
default: "ubuntu-latest"
type: string
sl_version:
description: "github/super-linter version ref"
required: false
default: "slim-v8"
type: string
# Free-form env to pass straight to Super-Linter (KEY=VALUE, one per line)
# https://thedocumentation.org/super-linter/usage/configuration
sl_env:
Expand All @@ -23,29 +18,32 @@ on:
token:
required: false

permissions:
contents: read

jobs:
superlinter:
name: Super-Linter
runs-on: ${{ inputs.runner }}
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false

# Convert the multi-line sl_env into environment variables
- name: Apply custom Super-Linter env
shell: bash
env:
SL_ENV_INPUT: ${{ inputs.sl_env }}
run: |
while IFS= read -r line; do
[[ -z "$line" || "$line" =~ ^\s*# ]] && continue
echo "$line" >> "$GITHUB_ENV"
done <<< "${{ inputs.sl_env }}"
done <<< "$SL_ENV_INPUT"

- name: Run Super-Linter
uses: github/super-linter@${{ inputs.sl_version }}
uses: super-linter/super-linter@ffde3b2b33b745cb612d787f669ef9442b1339a6
env:
GITHUB_TOKEN: ${{ secrets.token || github.token }}
# Any values written to $GITHUB_ENV above are also inherited here
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,37 @@ Runs [GitHub Super-Linter](https://github.com/super-linter/super-linter) to vali
#### Usage

**Basic usage:**

```yaml
name: Lint Code Base
on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint:
uses: validatedpatterns/github-actions-library/.github/workflows/superlinter.yml@v1
```

**With custom configuration:**

```yaml
name: Lint Code Base
on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint:
uses: validatedpatterns/github-actions-library/.github/workflows/superlinter.yml@v1
with:
runner: ubuntu-22.04
sl_version: slim-v7
sl_env: |
VALIDATE_ALL_CODEBASE=false
VALIDATE_MARKDOWN=false
Expand All @@ -46,11 +53,10 @@ jobs:

#### Inputs

| Input | Description | Required | Default |
| ------------ | ------------------------------------------------------------- | -------- | --------------- |
| `runner` | GitHub runner to use | No | `ubuntu-latest` |
| `sl_version` | GitHub Super-Linter version ref | No | `slim-v8` |
| `sl_env` | Extra Super-Linter environment variables (lines of KEY=VALUE) | No | `""` |
| Input | Description | Required | Default |
| -------- | ------------------------------------------------------------- | -------- | --------------- |
| `runner` | GitHub runner to use | No | `ubuntu-latest` |
| `sl_env` | Extra Super-Linter environment variables (lines of KEY=VALUE) | No | `""` |

#### Secrets

Expand All @@ -65,8 +71,8 @@ The workflow supports all Super-Linter configuration options through the `sl_env
#### Permissions

The workflow requires the following permissions:

- `contents: read` - To checkout the repository
- `pull-requests: read` - To read pull request information

These permissions are automatically set by the workflow and don't need to be configured in the calling workflow.

Expand All @@ -81,4 +87,4 @@ These permissions are automatically set by the workflow and don't need to be con
When adding new workflows:

1. Add the workflow YAML file to `.github/workflows/`
2. Update this main README with full documentation including usage, inputs, and examples
2. Update this readme with full documentation including usage, inputs, and examples
Loading