Skip to content

ci: add GH action to validate that the contents of latest are identical to the contents of whatever the most recent tag is #2

Description

@jdhoffa

@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 }}"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions