@embrace-ai/infra-api-schema-sync 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -10
- package/dist/src/generate-schema-url.d.ts.map +1 -1
- package/dist/src/generate-schema-url.js +21 -5
- package/dist/src/generate-schema-url.js.map +1 -1
- package/package.json +1 -1
- package/src/generate-schema-url.js +26 -5
- package/templates/workflows/emit-schema-update.yml +5 -6
- package/templates/workflows/graphql-schema-validate.yml +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [1.
|
|
3
|
+
## [1.1.1](https://github.com/Embrace-AI/infra-api-schema-sync/compare/v1.0.1...v1.1.1) (2025-10-07)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- **generate-schema-url:** fix stdout pollution in generate-schema-url command
|
|
4
8
|
|
|
9
|
+
- Changed logging to use GitHub Step Summary instead of stdout
|
|
10
|
+
- Stdout now contains only the URL for safe command substitution
|
|
11
|
+
- Fixes "Invalid format" error in GitHub Actions GITHUB_OUTPUT
|
|
12
|
+
- Logs appear in Actions Summary tab when GITHUB_STEP_SUMMARY is available
|
|
13
|
+
- Falls back to stderr notice when not in GitHub Actions
|
|
14
|
+
|
|
15
|
+
- **workflows:** fix validation report format in graphql-schema-validate.yml
|
|
16
|
+
- Changed `jq '.issues | length'` to `jq 'length'` to match actual report format
|
|
17
|
+
- Validation report is an array, not an object with issues property
|
|
18
|
+
|
|
19
|
+
## [1.0.1](https://github.com/Embrace-AI/infra-api-schema-sync/compare/v1.0.0...v1.0.1) (2025-06-19)
|
|
5
20
|
|
|
6
21
|
### Bug Fixes
|
|
7
22
|
|
|
8
|
-
|
|
23
|
+
- **workflows:** use pnpm exec in workflows, use correct build path in package.json for cli tool ([#8](https://github.com/Embrace-AI/infra-api-schema-sync/issues/8)) ([5b8daf3](https://github.com/Embrace-AI/infra-api-schema-sync/commit/5b8daf305dc8c868cf1766c1b4b4b5d86503b282))
|
|
9
24
|
|
|
10
25
|
## 1.0.0 (2025-06-19)
|
|
11
26
|
|
|
12
|
-
|
|
13
27
|
### Bug Fixes
|
|
14
28
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
- **commands:** remove unnecessary cli commands, update workflows, move bash to dispath-update ([14aa3a8](https://github.com/Embrace-AI/infra-api-schema-sync/commit/14aa3a82e142eb9c135bf6d409ad36d9cad5e20f))
|
|
30
|
+
- **lockfile:** update lockfile ([706bf37](https://github.com/Embrace-AI/infra-api-schema-sync/commit/706bf372d80d49692db9159da6ff25593869064a))
|
|
31
|
+
- **logging:** add globals for console logging in workflows ([fe00324](https://github.com/Embrace-AI/infra-api-schema-sync/commit/fe003249a5859b7769fce977556b71e610cb42d9))
|
|
32
|
+
- **workflow:** move dispatch logic to js, and update consumer workflow ([b0ff4c1](https://github.com/Embrace-AI/infra-api-schema-sync/commit/b0ff4c14096d090a50a93795dc45f69e5f2a6d8e))
|
|
33
|
+
- **workflows:** add issue_count and remove token in env ([662e8ad](https://github.com/Embrace-AI/infra-api-schema-sync/commit/662e8adae80cfc6a4f1ddfa389a28a94a7c04ac7))
|
|
34
|
+
- **workflows:** only emit update on \**/*schema.ts change, only show summary when issues are found ([2c2a589](https://github.com/Embrace-AI/infra-api-schema-sync/commit/2c2a589eff7192c833d008ac64e6bad6f5186acb))
|
|
35
|
+
- **workflows:** restore workflow files ([63eb5ad](https://github.com/Embrace-AI/infra-api-schema-sync/commit/63eb5ad7e1a4f2e004f6fad3524d3d30bb0278aa))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-schema-url.d.ts","sourceRoot":"","sources":["../../src/generate-schema-url.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-schema-url.d.ts","sourceRoot":"","sources":["../../src/generate-schema-url.js"],"names":[],"mappings":"AAaO,yDALJ;IAAwB,KAAK,EAArB,MAAM;IACU,OAAO,EAAvB,MAAM;IACU,IAAI,EAApB,MAAM;CACd,GAAU,MAAM,CAwBlB;AAkGM,qDAiDN"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execSync } from "child_process";
|
|
2
2
|
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
3
4
|
export const buildSchemaUrl = ({ stage = "dev", service, repo }) => {
|
|
4
5
|
if (!repo) {
|
|
5
6
|
repo = detectRepositoryName();
|
|
@@ -67,18 +68,33 @@ const extractServiceName = (repo) => {
|
|
|
67
68
|
export const generateSchemaUrl = (opts) => {
|
|
68
69
|
try {
|
|
69
70
|
const { stage, service, repo } = opts;
|
|
70
|
-
console.log("🔧 Generating schema URL...");
|
|
71
71
|
const detectedRepo = repo || detectRepositoryName();
|
|
72
72
|
const detectedService = service || extractServiceName(detectedRepo);
|
|
73
|
-
console.log(`📁 Repository: ${detectedRepo}`);
|
|
74
|
-
console.log(`🏷️ Service: ${detectedService}`);
|
|
75
|
-
console.log(`🚀 Stage: ${stage}`);
|
|
76
73
|
const url = buildSchemaUrl({
|
|
77
74
|
stage,
|
|
78
75
|
service: detectedService,
|
|
79
76
|
repo: detectedRepo,
|
|
80
77
|
});
|
|
81
|
-
|
|
78
|
+
const summaryPath = process.env.GITHUB_STEP_SUMMARY;
|
|
79
|
+
if (summaryPath) {
|
|
80
|
+
const md = [
|
|
81
|
+
"### Schema URL Generation",
|
|
82
|
+
"",
|
|
83
|
+
`- Repository: ${detectedRepo}`,
|
|
84
|
+
`- Service: ${detectedService}`,
|
|
85
|
+
`- Stage: ${stage}`,
|
|
86
|
+
`- URL: ${url}`,
|
|
87
|
+
"",
|
|
88
|
+
].join("\n");
|
|
89
|
+
try {
|
|
90
|
+
fs.appendFileSync(summaryPath, md);
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
process.stderr.write("::notice::Generated schema URL\n");
|
|
97
|
+
}
|
|
82
98
|
process.stdout.write(url);
|
|
83
99
|
return url;
|
|
84
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-schema-url.js","sourceRoot":"","sources":["../../src/generate-schema-url.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-schema-url.js","sourceRoot":"","sources":["../../src/generate-schema-url.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAWpB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;IAEjE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAGD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAGD,IACE,OAAO,KAAK,SAAS;QACrB,IAAI,KAAK,SAAS;QAClB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EACzB,CAAC;QACD,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAGD,OAAO,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC;AAOF,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;IAChC,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,KAAK;YACR,OAAO,8CAA8C,CAAC;QACxD;YACE,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,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AAC,CAAC;QAE1B,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAGF,eAAe,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { execSync } from "child_process";
|
|
2
2
|
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Generate a dynamic GraphQL schema URL based on repository and deployment stage
|
|
@@ -133,15 +135,15 @@ export const generateSchemaUrl = (opts) => {
|
|
|
133
135
|
try {
|
|
134
136
|
const { stage, service, repo } = opts;
|
|
135
137
|
|
|
136
|
-
|
|
138
|
+
|
|
137
139
|
|
|
138
140
|
// Detect values if not provided
|
|
139
141
|
const detectedRepo = repo || detectRepositoryName();
|
|
140
142
|
const detectedService = service || extractServiceName(detectedRepo);
|
|
141
143
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
145
147
|
|
|
146
148
|
const url = buildSchemaUrl({
|
|
147
149
|
stage,
|
|
@@ -149,7 +151,26 @@ export const generateSchemaUrl = (opts) => {
|
|
|
149
151
|
repo: detectedRepo,
|
|
150
152
|
});
|
|
151
153
|
|
|
152
|
-
|
|
154
|
+
const summaryPath = process.env.GITHUB_STEP_SUMMARY;
|
|
155
|
+
if (summaryPath) {
|
|
156
|
+
const md = [
|
|
157
|
+
"### Schema URL Generation",
|
|
158
|
+
"",
|
|
159
|
+
`- Repository: ${detectedRepo}`,
|
|
160
|
+
`- Service: ${detectedService}`,
|
|
161
|
+
`- Stage: ${stage}`,
|
|
162
|
+
`- URL: ${url}`,
|
|
163
|
+
"",
|
|
164
|
+
].join("\n");
|
|
165
|
+
try {
|
|
166
|
+
fs.appendFileSync(summaryPath, md);
|
|
167
|
+
} catch (e) {
|
|
168
|
+
// Ignore summary write failures
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
// Optional: Create a GitHub Actions notice without using console.*
|
|
172
|
+
process.stderr.write("::notice::Generated schema URL\n");
|
|
173
|
+
}
|
|
153
174
|
|
|
154
175
|
// Output just the URL for easy consumption by scripts
|
|
155
176
|
process.stdout.write(url);
|
|
@@ -6,7 +6,7 @@ on:
|
|
|
6
6
|
branches:
|
|
7
7
|
- main
|
|
8
8
|
paths:
|
|
9
|
-
-
|
|
9
|
+
- "**/*schema.ts"
|
|
10
10
|
workflow_dispatch: {}
|
|
11
11
|
|
|
12
12
|
env:
|
|
@@ -16,12 +16,12 @@ env:
|
|
|
16
16
|
# SCHEMA_URL: "https://api.dev.embrace.ai/v2/graphql/schema"
|
|
17
17
|
|
|
18
18
|
# Deployment stage - determines the environment URL pattern
|
|
19
|
-
DEPLOYMENT_STAGE: "dev"
|
|
19
|
+
DEPLOYMENT_STAGE: "dev" # Options: dev, prod, pr-* (e.g., pr-123)
|
|
20
20
|
# Optional: Override service name (auto-detected from repository name if not set)
|
|
21
21
|
# SERVICE_NAME: "your-service-name"
|
|
22
22
|
|
|
23
23
|
# Optional: Filter repositories by name pattern (regex)
|
|
24
|
-
REPO_FILTER: ".*"
|
|
24
|
+
REPO_FILTER: ".*" # Default: all repos. Example: "^(frontend|mobile|web)-.*" for specific patterns
|
|
25
25
|
permissions:
|
|
26
26
|
id-token: write
|
|
27
27
|
contents: read
|
|
@@ -41,7 +41,7 @@ jobs:
|
|
|
41
41
|
uses: actions/setup-node@v4
|
|
42
42
|
with:
|
|
43
43
|
node-version: 22.16.0
|
|
44
|
-
cache:
|
|
44
|
+
cache: "pnpm"
|
|
45
45
|
- name: Setup NPM
|
|
46
46
|
env:
|
|
47
47
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -49,7 +49,7 @@ jobs:
|
|
|
49
49
|
|
|
50
50
|
- name: Install GraphQL schema sync tool
|
|
51
51
|
# Update below to use the version you want
|
|
52
|
-
run: pnpm install -w @embrace-ai/infra-api-schema-sync@1.1.
|
|
52
|
+
run: pnpm install -w @embrace-ai/infra-api-schema-sync@1.1.1
|
|
53
53
|
|
|
54
54
|
# Generate dynamic schema URL based on repository and stage
|
|
55
55
|
- name: Generate schema URL
|
|
@@ -67,7 +67,6 @@ jobs:
|
|
|
67
67
|
echo "url=$SCHEMA_URL" >> $GITHUB_OUTPUT
|
|
68
68
|
echo "🌐 Generated schema URL: $SCHEMA_URL"
|
|
69
69
|
|
|
70
|
-
|
|
71
70
|
# Fetch all organization repositories and dispatch to each
|
|
72
71
|
- name: Dispatch schema update events to all org repositories
|
|
73
72
|
env:
|
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
uses: actions/setup-node@v4
|
|
21
21
|
with:
|
|
22
22
|
node-version: 22.16.0
|
|
23
|
-
cache:
|
|
23
|
+
cache: "pnpm"
|
|
24
24
|
|
|
25
25
|
- name: Setup NPM
|
|
26
26
|
env:
|
|
@@ -29,7 +29,7 @@ jobs:
|
|
|
29
29
|
|
|
30
30
|
- name: Install GraphQL schema sync tool
|
|
31
31
|
# Update line below to use the version you want
|
|
32
|
-
run: pnpm install -w @embrace-ai/infra-api-schema-sync@1.1.
|
|
32
|
+
run: pnpm install -w @embrace-ai/infra-api-schema-sync@1.1.1
|
|
33
33
|
|
|
34
34
|
- name: Configure aws credentials
|
|
35
35
|
uses: aws-actions/configure-aws-credentials@v4.2.1
|
|
@@ -55,9 +55,9 @@ jobs:
|
|
|
55
55
|
- name: Check for issues
|
|
56
56
|
id: check-issues
|
|
57
57
|
run: |
|
|
58
|
-
if [ -s report.json ] && [ "$(jq '
|
|
58
|
+
if [ -s report.json ] && [ "$(jq 'length' report.json)" -gt 0 ]; then
|
|
59
59
|
echo "has_issues=true" >> $GITHUB_OUTPUT
|
|
60
|
-
echo "issue_count=$(jq '
|
|
60
|
+
echo "issue_count=$(jq 'length' report.json)" >> $GITHUB_OUTPUT
|
|
61
61
|
else
|
|
62
62
|
echo "has_issues=false" >> $GITHUB_OUTPUT
|
|
63
63
|
echo "issue_count=0" >> $GITHUB_OUTPUT
|