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
12 changes: 10 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: go vet ./...
Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
# https://github.com/golangci/golangci-lint-action
Expand All @@ -37,3 +37,11 @@ jobs:
with:
version: "${{ env.GOLANGCI_LINT_VERSION }}"
args: --timeout=5m --tests=false ./...

action:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: ./ # use the checked out version of this repo as an action
with: # to lint the composite action it provides
actions: 'action.yml'
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,39 @@ composite-action-lint
=====================


A shallow structural copy of [actionlint][actionlint-repo] but instead for
linting the steps of [composite github actions][composite-action-tutorial]
instead of github workflow files.
A shallow structural copy of [actionlint][actionlint-repo]
but for linting the steps of [composite github actions][composite-action-tutorial]
instead of workflow files.


Significant portions of actionlint have been copied verbatim or with minor
changes. The actionlint license is included at
[ACTIONLINT_LICENSE.txt](./ACTIONLINT_LICENSE.txt)


## Usage

### in a workflow

Keep in mind: if you don't have any composite actions in your repo, you don't need this action.

```yaml
name: actionlint
on:
pull_request:
paths:
- .github/**

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: bettermarks/composite-action-lint@main
with:
actions: .github/actions/*/action.yml # this is the default value, so it can be omitted
```

## Installation

Installation requires a working [go][go] toolchain.
Expand All @@ -26,6 +49,7 @@ Then ensure you have `$(go env GOPATH)/bin` on your `PATH`.

Unlike actionlint, composite-action-lint does not search for actions to lint.
Pass each action metadata file as an argument to composite-action-lint
If the path does not point to an action file the command will fail.

```shell
composite-action-lint path/to-action/action.yml and/another/action.yaml
Expand Down
22 changes: 22 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: composite-action-lint

description: actionlint for composite actions

inputs:
actions:
description: space separated list of paths to actions to lint, supports wildcards
default: .github/actions/*/action.yml
required: false

runs:
using: composite
steps:
- uses: actions/setup-go@v6
with:
go-version: 'stable'
- name: Install composite-action-lint
run: go install github.com/bettermarks/composite-action-lint/cmd/composite-action-lint@latest
shell: sh
- name: Check composite actions
run: composite-action-lint ${{ inputs.actions }}
shell: sh