Skip to content

Commit e802399

Browse files
authored
CI: Check if all paths inside paths/ are included in paths.yml (#555)
Fixes #313 Signed-off-by: Vessel9817 <151808241+Vessel9817@users.noreply.github.com>
1 parent e138794 commit e802399

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,27 @@ jobs:
7474
continue-on-error: true
7575
run: pnpm run lint-ci
7676

77+
# Will fail if no paths are defined
78+
- name: assert no unused paths
79+
if: env.changes != ''
80+
run: |
81+
status=0
82+
mapfile -t expected <<< "$(yq -re '.paths | keys' openapi/components/paths/*.yaml | yq -r 'sort_by(.) | .[]')"
83+
mapfile -t actual <<< "$(yq -re 'sort_by(keys) | keys[]' openapi/components/paths.yaml)"
84+
85+
for ((i = 0, j = 0; i < "${#expected[@]}"; i++)); do
86+
if [[ "${expected[$i]}" == "${actual[$j]}" ]]; then
87+
j=$((j + 1))
88+
else
89+
status=2
90+
echo "Missing path: ${expected[$i]}" >&2;
91+
fi
92+
done;
93+
94+
if [[ "$status" -ne 0 ]]; then
95+
exit "$status"
96+
fi
97+
7798
bundle:
7899
runs-on: ubuntu-latest
79100
steps:

0 commit comments

Comments
 (0)