Skip to content

Commit 1e7e60f

Browse files
authored
Update lint_openapi_spec.yml
1 parent 58ec902 commit 1e7e60f

File tree

1 file changed

+58
-5
lines changed

1 file changed

+58
-5
lines changed

.github/workflows/lint_openapi_spec.yml

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: "Lint OpenAPI spec with vacuum"
22

33
on:
4+
push:
5+
paths:
6+
- 'QuantConnect-Platform-2.0.0.yaml'
47
pull_request:
58
paths:
69
- 'QuantConnect-Platform-2.0.0.yaml'
@@ -17,8 +20,58 @@ jobs:
1720
- name: Checkout repository
1821
uses: actions/checkout@v3
1922

20-
- name: Run OpenAPI lint with vacuum
21-
uses: pb33f/vacuum-action@v2
22-
with:
23-
openapi_path: "QuantConnect-Platform-2.0.0.yaml"
24-
github_token: ${{ secrets.GH_ACCESS_TOKEN }}
23+
- name: Lint OpenAPI specification using vacuum
24+
id: lint
25+
shell: bash
26+
env:
27+
DOCKER_BUILDKIT: 1
28+
OPENAPI_PATH: "QuantConnect-Platform-2.0.0.yaml"
29+
SHOW_RULES: "false"
30+
MINIMUM_SCORE: "70"
31+
FAIL_ON_ERROR: "true"
32+
RULESET: ""
33+
PRINT_LOGS: "true"
34+
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
35+
run: |
36+
args=( lint --pipeline-output "$OPENAPI_PATH" )
37+
38+
# --min-score <value>
39+
args+=( --min-score "$MINIMUM_SCORE" )
40+
41+
# --fail-severity none|error
42+
if [ "$FAIL_ON_ERROR" = "true" ]; then
43+
args+=( --fail-severity error )
44+
else
45+
args+=( --fail-severity none )
46+
fi
47+
48+
# --show-rules only if show_rules == "true"
49+
if [ "$SHOW_RULES" = "true" ]; then
50+
args+=( --show-rules )
51+
fi
52+
53+
# optional ruleset
54+
if [ -n "$RULESET" ]; then
55+
args+=( --ruleset "$RULESET" )
56+
fi
57+
58+
CMD=( docker run --rm \
59+
-v "$GITHUB_WORKSPACE":/work:ro \
60+
dshanley/vacuum "${args[@]}" )
61+
62+
echo "Running: ${CMD[*]}"
63+
report=$("${CMD[@]}")
64+
65+
REPORT_FILE="$GITHUB_WORKSPACE/vacuum-lint-report.md"
66+
{
67+
echo "<!-- vacuum-lint-report -->"
68+
echo
69+
echo "$report"
70+
} > "$REPORT_FILE"
71+
72+
# print logs to console if enabled
73+
if [ "$PRINT_LOGS" = "true" ]; then
74+
cat "$REPORT_FILE"
75+
fi
76+
77+
echo "report_path=vacuum-lint-report.md" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)