-
Notifications
You must be signed in to change notification settings - Fork 220
40 lines (39 loc) · 1.53 KB
/
validate.yaml
File metadata and controls
40 lines (39 loc) · 1.53 KB
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
name: Validate
on: [push, pull_request_target, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
env:
DMFR_SCHEMA_VERSION: v0.6.0
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
# Only needed for fork PRs - security check
- name: Security check for fork PRs
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
run: |
# Check if PR modifies .github or scripts directories
if git diff --name-only ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.base.sha }} | grep -q -E "^\.github/|^scripts/"; then
echo "Error: PR contains changes to .github or scripts directories, which is not allowed for security reasons"
exit 1
fi
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-node@v6
with:
node-version: '20.x'
- name: Install transitland-lib
run: scripts/install-transitland-lib.sh
- name: Validate against DMFR schema
run: |
wget https://dmfr.transit.land/json-schema/dmfr.schema-${{ env.DMFR_SCHEMA_VERSION }}.json -O dmfr.schema.json
npx ajv-cli validate -s dmfr.schema.json -d "feeds/*.json"
- name: Lint against the opinionated DMFR format
run: |
transitland dmfr lint feeds/*.dmfr.json
- name: Validate against transitland-lib
env:
DMFR_SCHEMA_VERSION: ${{ env.DMFR_SCHEMA_VERSION }}
working-directory: scripts
run: uv run validate-feeds.py