Skip to content

Commit 7f1f78d

Browse files
authored
Add yamllint configuration and fix lint warnings (#66)
- Add .yamllint.yaml config (disable document-start, line-length rules; ignore vendor/) - Add yamllint CI workflow - Fix truthy warnings in all workflow files with inline disable comments - Fix bracket spacing in smoke.yml - Fix step indentation in smoke.yml - Fix comment indentation in smoke.yml
1 parent f0b999f commit 7f1f78d

7 files changed

Lines changed: 87 additions & 49 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: CI
2-
on:
2+
on: # yamllint disable-line rule:truthy
33
push:
44
branches:
55
- main

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CodeQL
22

3-
on:
3+
on: # yamllint disable-line rule:truthy
44
push:
55
branches:
66
- main

.github/workflows/ghcr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Publish Docker images (GHCR)
2-
on:
2+
on: # yamllint disable-line rule:truthy
33
push:
44
branches:
55
- main

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Scorecard analysis
22

3-
on:
3+
on: # yamllint disable-line rule:truthy
44
push:
55
branches:
66
- main

.github/workflows/smoke.yml

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Smoke
33
permissions:
44
contents: read
55

6-
on:
6+
on: # yamllint disable-line rule:truthy
77
workflow_dispatch:
88
pull_request:
9-
branches: [ "main" ]
9+
branches: ["main"]
1010
paths-ignore:
1111
- docs/**
1212
- README.md
@@ -31,55 +31,55 @@ jobs:
3131
matrix:
3232
suite: ${{ fromJSON(needs.suites.outputs.suites) }}
3333
steps:
34-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35-
with:
36-
persist-credentials: false
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
with:
36+
persist-credentials: false
3737

38-
- name: Install Go
39-
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
40-
with:
41-
go-version-file: go.mod
38+
- name: Install Go
39+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
40+
with:
41+
go-version-file: go.mod
4242

43-
- name: Install Dependabot CLI
44-
run: go install github.com/dependabot/cli/cmd/dependabot@latest
43+
- name: Install Dependabot CLI
44+
run: go install github.com/dependabot/cli/cmd/dependabot@latest
4545

46-
- name: Download smoke test
47-
env:
48-
SUITE: ${{ matrix.suite }}
49-
run: |
50-
gh api "repos/dependabot/smoke-tests/contents/tests/smoke-${SUITE}.yaml" -H "Accept: application/vnd.github.raw" > smoke.yaml
46+
- name: Download smoke test
47+
env:
48+
SUITE: ${{ matrix.suite }}
49+
run: |
50+
gh api "repos/dependabot/smoke-tests/contents/tests/smoke-${SUITE}.yaml" -H "Accept: application/vnd.github.raw" > smoke.yaml
5151
52-
# Download the Proxy cache. The job is ideally 100% cached so no real calls are made.
53-
- name: Download cache
54-
env:
55-
SUITE: ${{ matrix.suite }}
56-
run: |
57-
gh run download --repo dependabot/smoke-tests --name "cache-${SUITE}" --dir cache
52+
# Download the Proxy cache. The job is ideally 100% cached so no real calls are made.
53+
- name: Download cache
54+
env:
55+
SUITE: ${{ matrix.suite }}
56+
run: |
57+
gh run download --repo dependabot/smoke-tests --name "cache-${SUITE}" --dir cache
5858
59-
- name: Build proxy image
60-
run: docker build -t "dependabot/proxy:latest" .
59+
- name: Build proxy image
60+
run: docker build -t "dependabot/proxy:latest" .
6161

62-
- name: ${{ matrix.suite }}
63-
env:
64-
LOCAL_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65-
run: |
66-
set -o pipefail
67-
dependabot test \
68-
-f=smoke.yaml \
69-
-o=result.yaml \
70-
--cache=cache \
71-
--timeout=20m \
72-
--proxy-image=dependabot/proxy:latest \
73-
2>&1 | tee -a log.txt
62+
- name: ${{ matrix.suite }}
63+
env:
64+
LOCAL_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
run: |
66+
set -o pipefail
67+
dependabot test \
68+
-f=smoke.yaml \
69+
-o=result.yaml \
70+
--cache=cache \
71+
--timeout=20m \
72+
--proxy-image=dependabot/proxy:latest \
73+
2>&1 | tee -a log.txt
7474
75-
- name: Diff
76-
if: always()
77-
continue-on-error: true
78-
run: diff --ignore-space-change smoke.yaml result.yaml && echo "Contents are identical"
75+
- name: Diff
76+
if: always()
77+
continue-on-error: true
78+
run: diff --ignore-space-change smoke.yaml result.yaml && echo "Contents are identical"
7979

80-
- name: Create summary
81-
run: tail -n100 log.txt | grep -P '\d+/\d+ calls cached \(\d+%\)' >> $GITHUB_STEP_SUMMARY
80+
- name: Create summary
81+
run: tail -n100 log.txt | grep -P '\d+/\d+ calls cached \(\d+%\)' >> $GITHUB_STEP_SUMMARY
8282

83-
# No upload at the end:
84-
# - If a test is uncachable in some regard, the cache would grow unbound.
85-
# - We might want to consider erroring if the cache is changed.
83+
# No upload at the end:
84+
# - If a test is uncachable in some regard, the cache would grow unbound.
85+
# - We might want to consider erroring if the cache is changed.

.github/workflows/yamllint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint YAML
2+
on: # yamllint disable-line rule:truthy
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
yamllint:
13+
name: yamllint
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
with:
19+
persist-credentials: false
20+
21+
# yamllint is pre-installed on GitHub Actions runners:
22+
# https://github.com/adrienverge/yamllint/pull/588
23+
- run: yamllint .

.yamllint.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
comments:
6+
min-spaces-from-content: 1
7+
comments-indentation: disable
8+
document-start: disable
9+
indentation:
10+
indent-sequences: consistent
11+
line-length: disable
12+
13+
ignore: |
14+
# Vendored dependencies
15+
vendor/

0 commit comments

Comments
 (0)