driftpipev0.9.4docs for Sign in

GitHub Actions

NAME

actions - a hosted workflow that annotates the lock on a pull request

This recipe fetches a pinned, checksum-verified binary and runs a strict check against a committed fixture, so that a reviewer sees the exact lines of schema.lock that would have to change.

WORKFLOW

.github/workflows/schema-drift.yml
name: schema-drift
on:
  pull_request:
    paths: ["fixtures/**", "schema.lock", ".driftpipe.yml"]

jobs:
  drift:
    runs-on: ubuntu-24.04
    steps:
      # check out with whichever step you already use
      - name: fetch driftpipe
        env:
          DP: "0.9.4"
        run: |
          curl -sSfLO "https://dl.driftpipe.sh/v$DP/driftpipe_${DP}_linux_amd64.tar.gz"
          curl -sSfLO "https://dl.driftpipe.sh/v$DP/SHA256SUMS"
          sha256sum --ignore-missing -c SHA256SUMS
          tar xzf "driftpipe_${DP}_linux_amd64.tar.gz" driftpipe
          install -m 0755 driftpipe /usr/local/bin/driftpipe
      - name: check fixture against lock
        run: driftpipe check --input fixtures/orders.ndjson --format github --fail-on any

WHAT IT CATCHES

With --format github the table is replaced by annotation lines, and the runner renders each one against the referenced line of the lock:

::warning file=schema.lock,line=14::new_fields: order.coupon_code (string)
::error file=schema.lock,line=9::nullability: order.customer_id (string -> string|null)
::error file=schema.lock,line=11::removed_fields: order.legacy_ref (string)

An error annotation marks the pull request as failed and points the author at the entry to edit. A new field has no existing line to sit on, so its annotation lands where the path would be inserted once the keys are re-sorted.

GOTCHAS

  • Keep the version in the DP variable and nowhere else, so a bump is a one-line edit reviewed like any other.
  • Run the checksum step even here; it is one request and it closes a supply-chain question for free.
  • Use --fail-on any only because the input is a reviewed fixture. Point this same job at raw data and it will cry wolf.