Skip to content

Commit cd4e616

Browse files
author
Nathan Gillett
committed
Add SOURCE_REF and CI check for tuple bookkeeping
Fail CI when HEAD diverges from SOURCE_REF so spec pins/matrix can record the SDK commit in the ecosystem tuple.
1 parent 62dc073 commit cd4e616

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
- name: Install dependencies
4545
run: pip install -e ".[dev]"
4646

47+
- name: Verify SOURCE_REF matches this commit
48+
run: bash scripts/check-source-ref.sh
49+
4750
- name: Verify sdk-signing fixtures match pinned spec
4851
env:
4952
INTENTPROOF_SPEC_DIR: intentproof-spec

SOURCE_REF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
62dc0738053fdab8d8a9178e0c7f674369599632

scripts/check-source-ref.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
# Fail when SOURCE_REF does not match the current commit (tuple bookkeeping).
3+
set -euo pipefail
4+
5+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6+
cd "$ROOT"
7+
8+
if [[ ! -f SOURCE_REF ]]; then
9+
echo "Missing SOURCE_REF in repository root" >&2
10+
exit 2
11+
fi
12+
13+
HEAD="$(git rev-parse HEAD)"
14+
REF="$(tr -d '[:space:]' < SOURCE_REF)"
15+
if ! echo "$REF" | grep -qE '^[0-9a-f]{40}$'; then
16+
echo "Invalid SOURCE_REF: must be a 40-character lowercase git SHA" >&2
17+
exit 1
18+
fi
19+
20+
if [[ "$HEAD" != "$REF" ]]; then
21+
echo "FAIL: SOURCE_REF ($REF) does not match HEAD ($HEAD)" >&2
22+
echo "Update SOURCE_REF and bump spec matrix/pins after merging SDK changes." >&2
23+
exit 1
24+
fi
25+
26+
echo "PASS: SOURCE_REF matches HEAD ($HEAD)."

0 commit comments

Comments
 (0)