Skip to content

Commit a6a8241

Browse files
committed
Add a soundness check to lint YAML files
1 parent caf3350 commit a6a8241

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extends: default
2+
3+
rules:
4+
line-length: false
5+
document-start: false
6+
truthy:
7+
check-keys: false # Otherwise we get a false positive on GitHub action's `on` key

.github/workflows/soundness.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ on:
5151
type: string
5252
description: "Container image for the shell check job. Defaults to latest Swift Ubuntu image."
5353
default: "swift:6.0-noble"
54+
yamllint_enabled:
55+
type: boolean
56+
description: "Boolean to enable the YAML lint job. Defaults to true."
57+
default: true
58+
yamllint_container_image:
59+
type: string
60+
description: "Container image for the YAML job. Defaults to latest Swift Ubuntu image."
61+
default: "swift:6.0-noble"
5462

5563
## We are cancelling previously triggered workflow runs
5664
concurrency:
@@ -177,3 +185,21 @@ jobs:
177185
run: |
178186
apt-get -qq update && apt-get -qq -y install shellcheck
179187
git ls-files -z '*.sh' | xargs -0 shellcheck
188+
189+
yaml-lint:
190+
name: Lint YAML
191+
if: ${{ inputs.yamllint_enabled }}
192+
runs-on: ubuntu-latest
193+
container:
194+
image: ${{ inputs.yamllint_container_image }}
195+
timeout-minutes: 5
196+
steps:
197+
- name: Checkout repository
198+
uses: actions/checkout@v4
199+
with:
200+
persist-credentials: false
201+
- name: Run yamllint
202+
run: |
203+
apt-get -qq update && apt-get -qq -y install yamllint
204+
curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/utils/yamllint-config.yml > /tmp/yamllint-config.yml
205+
yamllint --strict --config-file /tmp/yamllint-config.yml ${GITHUB_WORKSPACE}

0 commit comments

Comments
 (0)