Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add actionlint workflow #158

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions .github/workflows/lint-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint GitHub Actions workflows

on:
push:
paths:
- '**.yml'
tyrann0us marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
workflow_dispatch:
workflow_call:

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up problem matchers for actionlint
run: |
curl -s -o actionlint-matcher.json https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json
echo "::add-matcher::${GITHUB_WORKSPACE}/actionlint-matcher.json"

- name: Run actionlint
uses: docker://rhysd/actionlint:latest
with:
args: -color -pyflakes= -shellcheck=
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ groups here:

* Assets linting and formatting with [`@wordpress/scripts`](./docs/wp-scripts.md)
* Linting, formatting, and testing tools for [PHP](./docs/php.md)
* [Linting GitHub Actions workflow files](./docs/lint-workflows.md)
* Unit tests for [JavaScript](./docs/js.md)
* Assets compilation with [Composer Asset Compiler](./docs/assets-compilation.md) or
the [Build and push](./docs/build-and-push-assets.md) approach
Expand Down
15 changes: 15 additions & 0 deletions docs/lint-workflows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Lint GitHub Actions workflows

This workflow runs [actionlint](https://github.com/rhysd/actionlint). It does so by executing the
linter inside a Docker container using the official `actionlint` Docker image.

**Example:**

```yml
name: Lint GitHub Actions workflows
on:
pull_request:
jobs:
lint-workflows:
uses: inpsyde/reusable-workflows/.github/workflows/lint-workflows.yml@main
```