@john and I chatted about this in a DM on Teams, and I had a quick go at implementing it.
The following action should do the trick (assuming vX.Y.Z versioning. May need minor adjustments to account for timestamped versioning):
name: Validate Latest Schema
on:
push:
branches:
- main
paths:
- 'releases/**'
pull_request:
branches:
- main
paths:
- 'releases/**'
jobs:
validate-latest-schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Identify highest version schema directory
id: find-version
run: |
latest_version=$(ls schema/ | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1)
echo "latest_version=$latest_version" >> "$GITHUB_OUTPUT"
echo "Latest version directory: $latest_version"
- name: Compare latest to highest version
run: |
diff_output=$(diff -r schema/latest schema/${{ steps.find-version.outputs.latest_version }}) || (echo "$diff_output"; exit 1)
echo "✅ 'latest' schema matches highest version: ${{ steps.find-version.outputs.latest_version }}"
@john and I chatted about this in a DM on Teams, and I had a quick go at implementing it.
The following action should do the trick (assuming
vX.Y.Zversioning. May need minor adjustments to account for timestamped versioning):