Skip to content

Commit 679a228

Browse files
committed
feat(release): add reusable check-vendored-contracts workflow
Lets consumer repos (openemr/openemr, openemr/website-openemr, any future one) drift-check their vendored copies of dispatch.schema.json, TagVerifier.php, and TagVerificationResult.php against canonical with a single workflow_call line. Encapsulates the canonical openemr-devops checkout, PHP setup, and the bin/check-vendored.php invocation so each consumer adopts with one ~6-line workflow file and gets future drift-check improvements automatically. Inputs: consumer_subpath required — path within the caller repo holding the vendored copies (e.g. tools/release). canonical_ref optional — defaults to master; pin if a consumer needs a known-good ref while reconciling drift. path_overrides optional — newline-delimited canonical=consumer pairs for consumers that vendored into a non-canonical layout (website-openemr). Same shape as the reusable-workflow shim the May 8 follow-up on #664 proposes for the conductor itself; building it here at lower stakes validates the pattern. Refs #664. Assisted-by: Claude Code
1 parent 0504d05 commit 679a228

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Check Vendored Contracts
2+
3+
# Reusable workflow consumer repos call to fail their CI when their vendored
4+
# copies of cross-repo release contracts (dispatch.schema.json, TagVerifier,
5+
# TagVerificationResult) drift from the canonical sources here.
6+
#
7+
# See tools/release/src/VendoredFileChecker.php for the canonical file list.
8+
# See tools/release/contracts/dispatch.schema.json and
9+
# tools/release/src/TagVerifier.php for the contracts themselves.
10+
#
11+
# Caller example (in a consumer repo's PR workflow):
12+
#
13+
# jobs:
14+
# drift:
15+
# uses: openemr/openemr-devops/.github/workflows/check-vendored-contracts.yml@master
16+
# with:
17+
# consumer_subpath: tools/release
18+
#
19+
# website-openemr (which vendored into a non-canonical layout) passes overrides:
20+
#
21+
# with:
22+
# consumer_subpath: tools/release-docs
23+
# path_overrides: |
24+
# src/TagVerifier.php=src/Release/TagVerifier.php
25+
# src/TagVerificationResult.php=src/Release/TagVerificationResult.php
26+
27+
on:
28+
workflow_call:
29+
inputs:
30+
consumer_subpath:
31+
description: 'Path within the caller repo holding the vendored copies (e.g. tools/release).'
32+
required: true
33+
type: string
34+
canonical_ref:
35+
description: 'Ref of openemr/openemr-devops to compare against. Defaults to master.'
36+
required: false
37+
type: string
38+
default: master
39+
path_overrides:
40+
description: |
41+
Optional newline-delimited canonical=consumer path overrides for consumers
42+
that vendored into a non-canonical layout. Example:
43+
src/TagVerifier.php=src/Release/TagVerifier.php
44+
required: false
45+
type: string
46+
default: ''
47+
48+
permissions:
49+
contents: read
50+
51+
jobs:
52+
check:
53+
name: vendored contracts
54+
runs-on: ubuntu-24.04
55+
steps:
56+
- name: Checkout consumer
57+
uses: actions/checkout@v6
58+
59+
- name: Checkout canonical openemr-devops
60+
uses: actions/checkout@v6
61+
with:
62+
repository: openemr/openemr-devops
63+
ref: ${{ inputs.canonical_ref }}
64+
path: _canonical-openemr-devops
65+
66+
- name: Setup PHP
67+
uses: shivammathur/setup-php@v2
68+
with:
69+
php-version: '8.5'
70+
71+
- name: Install canonical release-tools dependencies
72+
working-directory: _canonical-openemr-devops/tools/release
73+
run: composer install --no-interaction --no-progress --no-dev
74+
75+
- name: Build override flags
76+
id: overrides
77+
env:
78+
PATH_OVERRIDES: ${{ inputs.path_overrides }}
79+
run: |
80+
flags=''
81+
while IFS= read -r line; do
82+
line="${line## }"
83+
line="${line%% }"
84+
[[ -z $line ]] && continue
85+
flags+=" --override $line"
86+
done <<< "$PATH_OVERRIDES"
87+
{
88+
echo "flags<<EOF"
89+
echo "$flags"
90+
echo "EOF"
91+
} >> "$GITHUB_OUTPUT"
92+
93+
- name: Check vendored contracts
94+
env:
95+
CONSUMER_PATH: ${{ github.workspace }}/${{ inputs.consumer_subpath }}
96+
OVERRIDE_FLAGS: ${{ steps.overrides.outputs.flags }}
97+
working-directory: _canonical-openemr-devops/tools/release
98+
run: |
99+
# shellcheck disable=SC2086 # OVERRIDE_FLAGS is a flag list; word-split is intentional
100+
php bin/check-vendored.php --consumer "$CONSUMER_PATH" $OVERRIDE_FLAGS

0 commit comments

Comments
 (0)