-
Notifications
You must be signed in to change notification settings - Fork 0
Add TPEN-side sender workflow for shared OpenAPI artifact sync to cubap/rerum_openapi
#522
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
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
79a52e0
`development` to `main` (#520)
thehabes 5734ab9
Initial plan
Copilot 6602808
feat: add sender workflow for shared OpenAPI artifact sync
Copilot 9e1ed9a
fix: target development branch for openapi sync PRs
Copilot 3eb83b3
chore: align OpenAPI sync workflow with seam rollout conventions
Copilot eda7276
Align sync files
thehabes 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,54 @@ | ||
| name: Sync TPEN-services shared OpenAPI artifact | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - development | ||
| paths: | ||
| - openapi/components/tpen-services-shared-components.openapi.yaml | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| sync: | ||
| name: Sync TPEN-services shared OpenAPI artifact | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout TPEN-services | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Checkout receiver repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: cubap/rerum_openapi | ||
| ref: main | ||
| token: ${{ secrets.OPENAPI }} | ||
| path: receiver | ||
|
|
||
| # No `test -f` guard: the receiver target may not exist on the first | ||
| # sync; cp creates it. Once the receiver registry references this file, | ||
| # add `test -f receiver/schemas/openapi/tpen-services-shared-components.openapi.yaml` | ||
| # to catch retargeted copies. | ||
|
|
||
| - name: Copy canonical shared artifact | ||
| run: cp openapi/components/tpen-services-shared-components.openapi.yaml receiver/schemas/openapi/tpen-services-shared-components.openapi.yaml | ||
|
|
||
| - name: Create or update sync pull request | ||
| uses: peter-evans/create-pull-request@v8 | ||
| with: | ||
| token: ${{ secrets.OPENAPI }} | ||
| path: receiver | ||
| add-paths: schemas/openapi/tpen-services-shared-components.openapi.yaml | ||
| commit-message: "chore: sync TPEN-services shared OpenAPI artifact" | ||
| branch: sync/tpen-services-shared-openapi | ||
| base: main | ||
| delete-branch: true | ||
| title: "chore: sync TPEN-services shared OpenAPI artifact" | ||
| body: | | ||
| Syncs the canonical TPEN-services shared OpenAPI artifact from CenterForDigitalHumanities/TPEN-services. | ||
|
|
||
| - Source commit: ${{ github.sha }} | ||
| - Source artifact: `openapi/components/tpen-services-shared-components.openapi.yaml` | ||
| - Target artifact: `schemas/openapi/tpen-services-shared-components.openapi.yaml` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import fs from "fs" | ||
| import path from "path" | ||
| import { fileURLToPath } from "url" | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url) | ||
| const __dirname = path.dirname(__filename) | ||
| const repoRoot = path.resolve(__dirname, "..") | ||
|
|
||
| describe("Shared OpenAPI artifact sync scaffolding #exists_unit", () => { | ||
| it("verifies provider artifact has expected OpenAPI baseline fields", () => { | ||
| const providerArtifactPath = path.join(repoRoot, "openapi/components/tpen-services-shared-components.openapi.yaml") | ||
| const providerArtifact = fs.readFileSync(providerArtifactPath, "utf8") | ||
|
|
||
| expect(providerArtifact).toContain("openapi: 3.0.3") | ||
| expect(providerArtifact).toContain("title: TPEN Services Shared OpenAPI Components") | ||
| expect(providerArtifact).toContain("version: 0.1.0") | ||
| expect(providerArtifact).toContain("components:") | ||
| expect(providerArtifact).toContain("schemas: {}") | ||
| }) | ||
|
|
||
| it("verifies the shared artifact sync workflow configuration", () => { | ||
| const workflowPath = path.join(repoRoot, ".github/workflows/sync_tpen_shared_openapi.yaml") | ||
| const workflow = fs.readFileSync(workflowPath, "utf8") | ||
|
|
||
| expect(workflow).toContain("openapi/components/tpen-services-shared-components.openapi.yaml") | ||
| expect(workflow).toContain("repository: cubap/rerum_openapi") | ||
| expect(workflow).toContain("schemas/openapi/tpen-services-shared-components.openapi.yaml") | ||
| expect(workflow).toContain("secrets.OPENAPI") | ||
| }) | ||
| }) | ||
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
13 changes: 13 additions & 0 deletions
13
openapi/components/tpen-services-shared-components.openapi.yaml
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,13 @@ | ||
| openapi: 3.0.3 | ||
| info: | ||
| title: TPEN Services Shared OpenAPI Components | ||
| version: 0.1.0 | ||
| description: Shared reusable OpenAPI components for TPEN services contracts. | ||
| externalDocs: | ||
| description: TPEN-services API reference | ||
| url: https://api.t-pen.org/API.html | ||
| x-upstream-provider: | ||
| name: TPEN-services | ||
| baseUrl: https://api.t-pen.org | ||
| components: | ||
| schemas: {} |
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.