-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (47 loc) · 1.26 KB
/
validate-docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: validate-docker-compose
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
validate-docker-compose:
name: runner / docker-compose-linter
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dclint
run: npm install --save-dev dclint
# Create config file to allow "latest" tag
- name: Create config file
run: |
cat <<EOL > config.json
{
"rules": {
"service-image-require-explicit-tag": [
1,
{
"prohibitedTags": [
"edge",
"test",
"nightly",
"dev",
"beta",
"canary",
]
}
]
}
}
EOL
- name: Run and Check for linting problems
id: check-dclint-output
run: |
npx dclint . -r -c config.json | tee dclint-output.log || true
if grep -E "✖ [0-9]+ problems" dclint-output.log; then
echo "::error::Linting errors detected"
exit 1
else
echo "No linting problems found"
fi