Skip to content

Commit 91f4607

Browse files
Copilotcubap
andauthored
Add TinyNode-owned shared OpenAPI artifact sync workflow (#121)
* Initial plan * feat: add shared openapi sync workflow Agent-Logs-Url: https://github.com/CenterForDigitalHumanities/TinyNode/sessions/cf70963e-0b89-4625-9d20-10949e9b6dc2 Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
1 parent 8c5c36d commit 91f4607

4 files changed

Lines changed: 163 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: TinyNode Shared OpenAPI Sync
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- openapi/components/tinynode-shared-components.openapi.yaml
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
sync:
16+
name: Sync shared OpenAPI artifact
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout TinyNode
20+
uses: actions/checkout@v4
21+
22+
- name: Checkout receiver repository
23+
uses: actions/checkout@v4
24+
with:
25+
repository: cubap/rerum_openapi
26+
ref: main
27+
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
28+
path: receiver
29+
30+
- name: Verify receiver stub exists
31+
run: test -f receiver/schemas/openapi/tinynode-shared-components.openapi.yaml
32+
33+
- name: Copy canonical shared artifact
34+
run: cp openapi/components/tinynode-shared-components.openapi.yaml receiver/schemas/openapi/tinynode-shared-components.openapi.yaml
35+
36+
- name: Create or update sync pull request
37+
uses: peter-evans/create-pull-request@v8
38+
with:
39+
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
40+
path: receiver
41+
add-paths: schemas/openapi/tinynode-shared-components.openapi.yaml
42+
commit-message: "chore: sync TinyNode shared OpenAPI artifact"
43+
branch: sync/tinynode-shared-openapi
44+
base: main
45+
delete-branch: true
46+
title: "chore: sync TinyNode shared OpenAPI artifact"
47+
body: |
48+
Syncs the canonical TinyNode shared OpenAPI artifact from CenterForDigitalHumanities/TinyNode.
49+
50+
- Source commit: ${{ github.sha }}
51+
- Source artifact: `openapi/components/tinynode-shared-components.openapi.yaml`
52+
- Target artifact: `schemas/openapi/tinynode-shared-components.openapi.yaml`

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ npm run ci:fast
6060
npm run ci:full
6161
```
6262

63+
### Shared OpenAPI Artifact
64+
TinyNode owns the canonical shared OpenAPI artifact at `openapi/components/tinynode-shared-components.openapi.yaml`.
65+
When that file changes on `main`, the `TinyNode Shared OpenAPI Sync` workflow copies it into `cubap/rerum_openapi` at `schemas/openapi/tinynode-shared-components.openapi.yaml` and opens or updates the sync pull request there. The workflow expects a repository secret named `OPENAPI_SYNC_TOKEN` with permission to push a sync branch and open pull requests in `cubap/rerum_openapi`.
66+
6367
And start the app
6468
```shell
6569
npm start
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
openapi: 3.0.3
2+
info:
3+
title: TinyNode Shared Components
4+
version: 0.1.0-alpha.1
5+
description: >-
6+
Shared schema components reused by multiple TinyNode seams. TinyNode route
7+
handlers are sourced from CenterForDigitalHumanities/TinyNode routes/
8+
(create.js, update.js, overwrite.js, query.js). TinyNode persists to
9+
rerum_server_nodejs at store.rerum.io/v1.
10+
externalDocs:
11+
description: TinyNode routes source of truth
12+
url: https://github.com/CenterForDigitalHumanities/TinyNode/tree/main/routes
13+
x-upstream-provider:
14+
name: rerum_server_nodejs
15+
baseUrl: https://store.rerum.io/v1
16+
components:
17+
schemas:
18+
HealthResponse:
19+
type: object
20+
required:
21+
- status
22+
properties:
23+
status:
24+
type: string
25+
enum: [ok]
26+
additionalProperties: true
27+
ReadinessResponse:
28+
type: object
29+
required:
30+
- status
31+
- timestamp
32+
properties:
33+
status:
34+
type: string
35+
enum: [ready]
36+
timestamp:
37+
type: string
38+
format: date-time
39+
additionalProperties: true
40+
OpenApiDocumentResponse:
41+
type: object
42+
additionalProperties: true
43+
DocumentPayload:
44+
type: object
45+
description: >-
46+
Request document with stable core fields and open extension fields.
47+
Consumer-specific metadata can be included without breaking this
48+
contract.
49+
properties:
50+
'@id':
51+
type: string
52+
description: Existing identifier for update/overwrite semantics.
53+
'@context':
54+
description: JSON-LD context when present.
55+
oneOf:
56+
- type: string
57+
- type: array
58+
- type: object
59+
'@type':
60+
description: JSON-LD type when present.
61+
oneOf:
62+
- type: string
63+
- type: array
64+
additionalProperties: true
65+
DocumentResponse:
66+
type: object
67+
description: Response document with required identity and open extension fields.
68+
required:
69+
- '@id'
70+
properties:
71+
'@id':
72+
type: string
73+
description: Canonical TinyNode identifier for the document.
74+
additionalProperties: true
75+
QueryResponse:
76+
description: Query responses may be a raw array or a wrapped object.
77+
oneOf:
78+
- type: array
79+
items:
80+
$ref: '#/components/schemas/DocumentResponse'
81+
- type: object
82+
required:
83+
- results
84+
properties:
85+
results:
86+
type: array
87+
items:
88+
$ref: '#/components/schemas/DocumentResponse'
89+
total:
90+
type: integer
91+
minimum: 0
92+
additionalProperties: true
93+
ErrorResponse:
94+
type: object
95+
description: Generic error envelope used across operations.
96+
properties:
97+
message:
98+
type: string
99+
error:
100+
type: string
101+
status:
102+
type: integer
103+
minimum: 100
104+
maximum: 599
105+
additionalProperties: true

test/routes/mount.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,7 @@ describe("Check to see that critical repo files are present", () => {
6565
assert.equal(fs.existsSync(`${filePath}README.md`), true)
6666
assert.equal(fs.existsSync(`${filePath}.gitignore`), true)
6767
assert.equal(fs.existsSync(`${filePath}package.json`), true)
68+
assert.equal(fs.existsSync(`${filePath}.github/workflows/shared_openapi_sync.yaml`), true)
69+
assert.equal(fs.existsSync(`${filePath}openapi/components/tinynode-shared-components.openapi.yaml`), true)
6870
})
6971
})

0 commit comments

Comments
 (0)