-
-
Notifications
You must be signed in to change notification settings - Fork 175
feat(release): reusable check-vendored-contracts workflow + path overrides #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kojiromike
merged 7 commits into
openemr:master
from
kojiromike:release-drift-check-workflow
May 13, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8ba9fcf
feat(release): support per-consumer path overrides in vendored-file c…
kojiromike 0714b0c
feat(release): add reusable check-vendored-contracts workflow
kojiromike 05ee522
test(release): self-test the check-vendored-contracts workflow
kojiromike b254809
refactor(release): parse override list in PHP, drop shell construction
kojiromike 60301a1
feat(release): reject unsafe override values in VendoredFileChecker
kojiromike d76e306
ci(release): trigger self-test on release-tools dependency changes
kojiromike 9bb0b15
fix(release): validate override key/value types at constructor
kojiromike File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: Check Vendored Contracts | ||
|
|
||
| # Reusable workflow for consumer repos to drift-check their vendored copies | ||
| # of cross-repo release contracts (dispatch.schema.json, TagVerifier, | ||
| # TagVerificationResult) against the canonical sources here. Fails the | ||
| # calling job on drift. | ||
| # | ||
| # See tools/release/src/VendoredFileChecker.php for the canonical file list. | ||
| # See tools/release/contracts/dispatch.schema.json and | ||
| # tools/release/src/TagVerifier.php for the contracts themselves. | ||
| # | ||
| # Caller example (in a consumer repo's PR workflow): | ||
| # | ||
| # jobs: | ||
| # drift: | ||
| # uses: openemr/openemr-devops/.github/workflows/check-vendored-contracts.yml@master | ||
| # with: | ||
| # consumer_subpath: tools/release | ||
| # | ||
| # website-openemr (which vendored into a non-canonical layout) passes overrides: | ||
| # | ||
| # with: | ||
| # consumer_subpath: tools/release-docs | ||
| # path_overrides: | | ||
| # src/TagVerifier.php=src/Release/TagVerifier.php | ||
| # src/TagVerificationResult.php=src/Release/TagVerificationResult.php | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| consumer_subpath: | ||
| description: 'Path within the caller repo holding the vendored copies (e.g. tools/release).' | ||
| required: true | ||
| type: string | ||
| canonical_ref: | ||
| description: 'Ref of openemr/openemr-devops to compare against. Defaults to master.' | ||
| required: false | ||
| type: string | ||
| default: master | ||
| path_overrides: | ||
| description: | | ||
| Optional newline-delimited canonical=consumer path overrides for consumers | ||
| that vendored into a non-canonical layout. Example: | ||
| src/TagVerifier.php=src/Release/TagVerifier.php | ||
| required: false | ||
| type: string | ||
| default: '' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| check: | ||
| name: vendored contracts | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout consumer | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Checkout canonical openemr-devops | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: openemr/openemr-devops | ||
| ref: ${{ inputs.canonical_ref }} | ||
| path: _canonical-openemr-devops | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.5' | ||
|
|
||
| - name: Install canonical release-tools dependencies | ||
| working-directory: _canonical-openemr-devops/tools/release | ||
| run: composer install --no-interaction --no-progress --no-dev | ||
|
|
||
| - name: Check vendored contracts | ||
| env: | ||
| CONSUMER_PATH: ${{ github.workspace }}/${{ inputs.consumer_subpath }} | ||
| PATH_OVERRIDES: ${{ inputs.path_overrides }} | ||
| working-directory: _canonical-openemr-devops/tools/release | ||
| run: php bin/check-vendored.php --consumer "$CONSUMER_PATH" --overrides "$PATH_OVERRIDES" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Test Vendored Contracts (self-test) | ||
|
|
||
| # Exercises check-vendored-contracts.yml against committed fixtures so the | ||
| # reusable workflow has end-to-end CI coverage in this repo. Without this, | ||
| # its only validation is whatever consumer adopts it first. | ||
| # | ||
| # good — canonical layout, no overrides. Validates checkout | ||
| # wiring, composer install, and CLI invocation. | ||
| # good-with-overrides — same content under a website-openemr-style | ||
| # src/Release/ layout. Exercises the path_overrides | ||
| # input end-to-end (newline-delimited string → | ||
| # PHP-side parsing in --overrides). | ||
| # | ||
| # Drift-detection failure propagation isn't tested here — exit-code → job | ||
| # status is GHA's intrinsic behavior, so a drifted fixture just turns the | ||
| # test red without proving anything new about the workflow. | ||
| # | ||
| # canonical_ref pins to the PR head SHA so the test compares against this | ||
| # PR's canonical files, not whatever happens to be on master. | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/check-vendored-contracts.yml' | ||
| - '.github/workflows/vendored-contracts-self-test.yml' | ||
| - 'tools/release/bin/check-vendored.php' | ||
| - 'tools/release/src/VendoredFileChecker.php' | ||
| - 'tools/release/src/VendoredDriftIssue.php' | ||
| - 'tools/release/contracts/dispatch.schema.json' | ||
| - 'tools/release/src/TagVerifier.php' | ||
| - 'tools/release/src/TagVerificationResult.php' | ||
| - 'tools/release/tests/fixtures/vendored/**' | ||
| - 'tools/release/composer.json' | ||
| - 'tools/release/composer.lock' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
|
||
| jobs: | ||
| good: | ||
| name: good fixture matches canonical | ||
| uses: ./.github/workflows/check-vendored-contracts.yml | ||
| with: | ||
| consumer_subpath: tools/release/tests/fixtures/vendored/good | ||
| canonical_ref: ${{ github.event.pull_request.head.sha }} | ||
|
|
||
| good-with-overrides: | ||
| name: good fixture under website-style layout via path_overrides | ||
| uses: ./.github/workflows/check-vendored-contracts.yml | ||
| with: | ||
| consumer_subpath: tools/release/tests/fixtures/vendored/good-overrides | ||
| canonical_ref: ${{ github.event.pull_request.head.sha }} | ||
| path_overrides: | | ||
| src/TagVerifier.php=src/Release/TagVerifier.php | ||
| src/TagVerificationResult.php=src/Release/TagVerificationResult.php | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.