Skip to content

Commit ccfa9f9

Browse files
committed
Add some more lint/format checks.
* Add yamlfmt as a required check * Make it easier for people to run the checks locally
1 parent 23bd09f commit ccfa9f9

File tree

7 files changed

+31
-4
lines changed

7 files changed

+31
-4
lines changed

.github/workflows/markdown_format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
uses: 'actions/checkout@v4'
1717

1818
- name: 'Check Markdown Format'
19-
run: 'pipx run mdformat --check --wrap 100 .'
19+
run: 'tools/mdformat --check --wrap 100 .'

.github/workflows/yaml_format.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### Ensure that Yaml files are properly formatted
2+
name: 'Check Yaml Format'
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- '**.yml'
8+
- '**.yaml'
9+
10+
jobs:
11+
yamlfmt:
12+
name: 'yamlfmt'
13+
runs-on: 'ubuntu-latest'
14+
15+
steps:
16+
- name: 'Checkout Code'
17+
uses: 'actions/checkout@v4'
18+
19+
- name: 'Check Yaml Format'
20+
run: 'tools/yamlfmt --lint --dstar "**/*.yaml"'

.yamlfmt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
formatter:
2+
lines: 100
3+

semgrep-rules/actions/pull_request_target_needs_exception.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ rules:
77
metadata:
88
category: best-practice
99
technology:
10-
- github-actions
10+
- github-actions
1111
patterns:
1212
- pattern-either:
1313
- patterns:
1414
- pattern-inside: "{on: ...}"
15-
- pattern: pull_request_target
15+
- pattern: pull_request_target
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
on:
22
# ruleid: pull-request-target-needs-exception
3-
pull_request_target:
3+
pull_request_target:

tools/mdformat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
pipx run mdformat $*

tools/yamlfmt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
docker run -v "$(pwd):/project" ghcr.io/google/yamlfmt:latest $*

0 commit comments

Comments
 (0)