@postman-cse/onboarding-repo-sync 2.1.19 → 2.2.0
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/README.md +12 -0
- package/action.yml +8 -0
- package/dist/action.cjs +85 -0
- package/dist/cli.cjs +85 -0
- package/dist/index.cjs +85 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -115,6 +115,15 @@ with:
|
|
|
115
115
|
|
|
116
116
|
Repo-sync supports public mocks for anonymous validation. An explicit `mock-url` must match one mock in the resolved workspace and reference the expected baseline collection and environment. Discovered and newly created mocks pass the same live visibility check. Private mocks, responses without a recognized visibility field, stale URLs, and identity mismatches fail before `mock-url` is emitted; repo-sync never places a Postman API key in a collection or environment to make a private mock callable.
|
|
117
117
|
|
|
118
|
+
For manual collection validation against that public mock, opt in to a dedicated Postman environment:
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
with:
|
|
122
|
+
mock-environment-enabled: true
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
On canonical and legacy runs, the action creates or reuses `<project> - Mock`, sets its `baseUrl` to the validated mock URL, and emits `mock-environment-uid`. Preview and channel runs skip it so branch retention cleanup cannot leak an untracked environment. Its exported representation lives at `postman/mocks/manual-validation.postman_environment.json`; it is deliberately excluded from `environment-uids-json`, system-environment associations, monitors, and generated CI environment selection. Select it explicitly when running baseline, Smoke, or Contract collections manually. Repo-sync never replaces the runtime `prod` or `dev` `baseUrl` with a mock URL.
|
|
126
|
+
|
|
118
127
|
### mTLS certificates for Postman CLI runs
|
|
119
128
|
|
|
120
129
|
The generated CI workflow can run [Postman CLI collection runs](https://learning.postman.com/docs/postman-cli/postman-cli-collections/) with client certificates. Pass the cert material as inputs; when a GitHub token and repository context are available, the action persists them as repository secrets (`POSTMAN_SSL_CLIENT_CERT_B64`, `POSTMAN_SSL_CLIENT_KEY_B64`, `POSTMAN_SSL_CLIENT_PASSPHRASE`, `POSTMAN_SSL_EXTRA_CA_CERTS_B64`) for the generated workflow:
|
|
@@ -146,6 +155,7 @@ with:
|
|
|
146
155
|
| `release-label` | Optional release label used for versioned naming. | no | |
|
|
147
156
|
| `monitor-id` | Existing smoke monitor ID. When set, the action validates and reuses this monitor instead of creating a new one. | no | |
|
|
148
157
|
| `mock-url` | Existing mock server URL. When set, the action validates and reuses this mock instead of creating a new one. | no | |
|
|
158
|
+
| `mock-environment-enabled` | Create or update a dedicated manual-validation environment whose baseUrl is the validated public mock URL. This environment is excluded from runtime CI selection. | no | `false` |
|
|
149
159
|
| `monitor-cron` | Cron expression for monitor scheduling (e.g. '0 */6 * * *'). When empty, the monitor is created disabled and triggered to run once per workflow invocation (and once on every subsequent run). | no | `""` |
|
|
150
160
|
| `environments-json` | JSON array of environment slugs to create or update. | no | `["prod"]` |
|
|
151
161
|
| `git-provider` | Git provider override ('github', 'gitlab', 'bitbucket', 'azure-devops'). Auto-detected from environment when omitted. | no | |
|
|
@@ -193,6 +203,8 @@ with:
|
|
|
193
203
|
| `environment-sync-status` | Whether environment sync succeeded, was skipped, or failed. |
|
|
194
204
|
| `environment-uids-json` | JSON map of environment slug to Postman environment uid. |
|
|
195
205
|
| `mock-url` | Created or reused mock server URL. |
|
|
206
|
+
| `mock-environment-uid` | Dedicated manual-validation environment UID when mock-environment-enabled succeeds. |
|
|
207
|
+
| `mock-environment-status` | Whether the optional manual-validation mock environment succeeded, was skipped, or failed. |
|
|
196
208
|
| `monitor-id` | Created or reused smoke monitor ID. |
|
|
197
209
|
| `repo-sync-summary-json` | JSON summary of repo materialization and workspace sync outputs. |
|
|
198
210
|
| `commit-sha` | Commit SHA produced by repo-write-mode, if any. |
|
package/action.yml
CHANGED
|
@@ -57,6 +57,10 @@ inputs:
|
|
|
57
57
|
mock-url:
|
|
58
58
|
description: Existing mock server URL. When set, the action validates and reuses this mock instead of creating a new one.
|
|
59
59
|
required: false
|
|
60
|
+
mock-environment-enabled:
|
|
61
|
+
description: Create or update a dedicated manual-validation environment whose baseUrl is the validated public mock URL. This environment is excluded from runtime CI selection.
|
|
62
|
+
required: false
|
|
63
|
+
default: "false"
|
|
60
64
|
monitor-cron:
|
|
61
65
|
description: Cron expression for monitor scheduling (e.g. '0 */6 * * *'). When empty, the monitor is created disabled and triggered to run once per workflow invocation (and once on every subsequent run).
|
|
62
66
|
required: false
|
|
@@ -200,6 +204,10 @@ outputs:
|
|
|
200
204
|
description: JSON map of environment slug to Postman environment uid.
|
|
201
205
|
mock-url:
|
|
202
206
|
description: Created or reused mock server URL.
|
|
207
|
+
mock-environment-uid:
|
|
208
|
+
description: Dedicated manual-validation environment UID when mock-environment-enabled succeeds.
|
|
209
|
+
mock-environment-status:
|
|
210
|
+
description: Whether the optional manual-validation mock environment succeeded, was skipped, or failed.
|
|
203
211
|
monitor-id:
|
|
204
212
|
description: Created or reused smoke monitor ID.
|
|
205
213
|
repo-sync-summary-json:
|
package/dist/action.cjs
CHANGED
|
@@ -136660,6 +136660,11 @@ var postmanRepoSyncActionContract = {
|
|
|
136660
136660
|
description: "Existing mock server URL. When set, the action validates and reuses this mock instead of creating a new one.",
|
|
136661
136661
|
required: false
|
|
136662
136662
|
},
|
|
136663
|
+
"mock-environment-enabled": {
|
|
136664
|
+
description: "Create or update a dedicated manual-validation environment whose baseUrl is the validated public mock URL. This environment is excluded from runtime CI selection.",
|
|
136665
|
+
required: false,
|
|
136666
|
+
default: "false"
|
|
136667
|
+
},
|
|
136663
136668
|
"monitor-cron": {
|
|
136664
136669
|
description: "Cron expression for monitor scheduling (e.g. '0 */6 * * *'). When empty, the monitor is created disabled and triggered to run once per workflow invocation (and once on every subsequent run).",
|
|
136665
136670
|
required: false,
|
|
@@ -136853,6 +136858,12 @@ var postmanRepoSyncActionContract = {
|
|
|
136853
136858
|
"mock-url": {
|
|
136854
136859
|
description: "Created or reused mock server URL."
|
|
136855
136860
|
},
|
|
136861
|
+
"mock-environment-uid": {
|
|
136862
|
+
description: "Dedicated manual-validation environment UID when mock-environment-enabled succeeds."
|
|
136863
|
+
},
|
|
136864
|
+
"mock-environment-status": {
|
|
136865
|
+
description: "Whether the optional manual-validation mock environment succeeded, was skipped, or failed."
|
|
136866
|
+
},
|
|
136856
136867
|
"monitor-id": {
|
|
136857
136868
|
description: "Created or reused smoke monitor ID."
|
|
136858
136869
|
},
|
|
@@ -138785,6 +138796,7 @@ function resolveInputs(env = process.env) {
|
|
|
138785
138796
|
orgMode: parseBooleanInput(getInput2("org-mode", env), false),
|
|
138786
138797
|
monitorId: getInput2("monitor-id", env),
|
|
138787
138798
|
mockUrl: getInput2("mock-url", env),
|
|
138799
|
+
mockEnvironmentEnabled: parseBooleanInput(getInput2("mock-environment-enabled", env), false),
|
|
138788
138800
|
monitorCron: getInput2("monitor-cron", env),
|
|
138789
138801
|
sslClientCert: getInput2("ssl-client-cert", env),
|
|
138790
138802
|
sslClientKey: getInput2("ssl-client-key", env),
|
|
@@ -139011,6 +139023,8 @@ function createOutputs(inputs) {
|
|
|
139011
139023
|
"environment-sync-status": "skipped",
|
|
139012
139024
|
"environment-uids-json": JSON.stringify(inputs.environmentUids),
|
|
139013
139025
|
"mock-url": "",
|
|
139026
|
+
"mock-environment-uid": "",
|
|
139027
|
+
"mock-environment-status": "skipped",
|
|
139014
139028
|
"monitor-id": "",
|
|
139015
139029
|
"repo-sync-summary-json": "{}",
|
|
139016
139030
|
"commit-sha": "",
|
|
@@ -139078,6 +139092,7 @@ function readActionInputs(actionCore) {
|
|
|
139078
139092
|
INPUT_ORG_MODE: readInput(actionCore, "org-mode"),
|
|
139079
139093
|
INPUT_MONITOR_ID: readInput(actionCore, "monitor-id"),
|
|
139080
139094
|
INPUT_MOCK_URL: readInput(actionCore, "mock-url"),
|
|
139095
|
+
INPUT_MOCK_ENVIRONMENT_ENABLED: readInput(actionCore, "mock-environment-enabled"),
|
|
139081
139096
|
INPUT_MONITOR_CRON: readInput(actionCore, "monitor-cron"),
|
|
139082
139097
|
INPUT_SSL_CLIENT_CERT: sslClientCert,
|
|
139083
139098
|
INPUT_SSL_CLIENT_KEY: sslClientKey,
|
|
@@ -139279,6 +139294,52 @@ async function upsertEnvironments(inputs, dependencies, resourcesState, assetMar
|
|
|
139279
139294
|
}
|
|
139280
139295
|
return envUids;
|
|
139281
139296
|
}
|
|
139297
|
+
async function upsertMockEnvironment(inputs, dependencies, assetProjectName, mockUrl) {
|
|
139298
|
+
if (!inputs.mockEnvironmentEnabled || !inputs.workspaceId || !mockUrl) {
|
|
139299
|
+
return "";
|
|
139300
|
+
}
|
|
139301
|
+
const displayName = `${assetProjectName} - Mock`;
|
|
139302
|
+
const values = buildEnvironmentValues("mock", mockUrl);
|
|
139303
|
+
const mask = resolveRepoSyncMasker(dependencies);
|
|
139304
|
+
try {
|
|
139305
|
+
const discovered = await dependencies.postman.findEnvironmentByName(
|
|
139306
|
+
inputs.workspaceId,
|
|
139307
|
+
displayName
|
|
139308
|
+
);
|
|
139309
|
+
if (discovered?.uid) {
|
|
139310
|
+
try {
|
|
139311
|
+
const existing = await dependencies.postman.getEnvironment(discovered.uid);
|
|
139312
|
+
const currentValues = existing.data?.values ?? existing.values ?? [];
|
|
139313
|
+
if (currentValues.some((value) => value.key === "baseUrl" && value.value === mockUrl)) {
|
|
139314
|
+
dependencies.core.info(`Mock environment already points to ${mockUrl}: ${discovered.uid}`);
|
|
139315
|
+
return discovered.uid;
|
|
139316
|
+
}
|
|
139317
|
+
} catch {
|
|
139318
|
+
}
|
|
139319
|
+
await dependencies.postman.updateEnvironment(discovered.uid, displayName, values);
|
|
139320
|
+
dependencies.core.info(`Updated mock environment ${displayName}: ${discovered.uid}`);
|
|
139321
|
+
return discovered.uid;
|
|
139322
|
+
}
|
|
139323
|
+
const uid = await dependencies.postman.createEnvironment(
|
|
139324
|
+
inputs.workspaceId,
|
|
139325
|
+
displayName,
|
|
139326
|
+
values
|
|
139327
|
+
);
|
|
139328
|
+
dependencies.core.info(`Created mock environment ${displayName}: ${uid}`);
|
|
139329
|
+
return uid;
|
|
139330
|
+
} catch (error2) {
|
|
139331
|
+
dependencies.core.warning(
|
|
139332
|
+
formatOrchestrationIssue({
|
|
139333
|
+
operation: "Mock environment upsert",
|
|
139334
|
+
entity: `workspace ${inputs.workspaceId} environment "${displayName}"`,
|
|
139335
|
+
cause: error2,
|
|
139336
|
+
remediation: "verify environment access or disable mock-environment-enabled then rerun",
|
|
139337
|
+
mask
|
|
139338
|
+
})
|
|
139339
|
+
);
|
|
139340
|
+
return "";
|
|
139341
|
+
}
|
|
139342
|
+
}
|
|
139282
139343
|
function ensureDir(path9) {
|
|
139283
139344
|
(0, import_node_fs5.mkdirSync)(path9, { recursive: true });
|
|
139284
139345
|
}
|
|
@@ -139917,6 +139978,13 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
139917
139978
|
true
|
|
139918
139979
|
);
|
|
139919
139980
|
}
|
|
139981
|
+
if (options.mockEnvironmentUid) {
|
|
139982
|
+
writeJsonFile(
|
|
139983
|
+
`${mocksDir}/manual-validation.postman_environment.json`,
|
|
139984
|
+
await dependencies.postman.getEnvironment(options.mockEnvironmentUid),
|
|
139985
|
+
true
|
|
139986
|
+
);
|
|
139987
|
+
}
|
|
139920
139988
|
const durableWorkspaceId = resolveDurableWorkspaceId({
|
|
139921
139989
|
candidateId: inputs.workspaceId,
|
|
139922
139990
|
priorId: options.priorWorkspaceId,
|
|
@@ -139975,6 +140043,8 @@ function createRepoSummary(outputs, envUids, pushed) {
|
|
|
139975
140043
|
commitSha: outputs["commit-sha"],
|
|
139976
140044
|
environmentCount: Object.keys(envUids).length,
|
|
139977
140045
|
environmentSyncStatus: outputs["environment-sync-status"],
|
|
140046
|
+
mockEnvironmentStatus: outputs["mock-environment-status"],
|
|
140047
|
+
mockEnvironmentUid: outputs["mock-environment-uid"],
|
|
139978
140048
|
mockUrl: outputs["mock-url"],
|
|
139979
140049
|
monitorId: outputs["monitor-id"],
|
|
139980
140050
|
pushed,
|
|
@@ -140300,6 +140370,20 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140300
140370
|
}
|
|
140301
140371
|
outputs["mock-url"] = resolvedMockUrl;
|
|
140302
140372
|
dependencies.core.setOutput("mock-url", resolvedMockUrl);
|
|
140373
|
+
if (inputs.mockEnvironmentEnabled && isCanonicalWriter) {
|
|
140374
|
+
const mockEnvironmentUid = await upsertMockEnvironment(
|
|
140375
|
+
inputs,
|
|
140376
|
+
dependencies,
|
|
140377
|
+
assetProjectName,
|
|
140378
|
+
resolvedMockUrl
|
|
140379
|
+
);
|
|
140380
|
+
outputs["mock-environment-uid"] = mockEnvironmentUid;
|
|
140381
|
+
outputs["mock-environment-status"] = mockEnvironmentUid ? "success" : "failed";
|
|
140382
|
+
} else if (inputs.mockEnvironmentEnabled) {
|
|
140383
|
+
dependencies.core.warning(
|
|
140384
|
+
"mock-environment-enabled is skipped for preview and channel runs so manual-validation environments cannot escape branch retention cleanup."
|
|
140385
|
+
);
|
|
140386
|
+
}
|
|
140303
140387
|
}
|
|
140304
140388
|
}
|
|
140305
140389
|
if (inputs.workspaceId && inputs.smokeCollectionId && Object.keys(envUids).length > 0) {
|
|
@@ -140432,6 +140516,7 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140432
140516
|
workspaceLinkStatus: outputs["workspace-link-status"],
|
|
140433
140517
|
priorWorkspaceId: resourcesState?.workspace?.id,
|
|
140434
140518
|
existingSpecs: resourcesState?.cloudResources?.specs,
|
|
140519
|
+
mockEnvironmentUid: outputs["mock-environment-uid"] || void 0,
|
|
140435
140520
|
releaseLabel,
|
|
140436
140521
|
priorState: resourcesState,
|
|
140437
140522
|
preparedPrebuiltCollections
|
package/dist/cli.cjs
CHANGED
|
@@ -134765,6 +134765,11 @@ var postmanRepoSyncActionContract = {
|
|
|
134765
134765
|
description: "Existing mock server URL. When set, the action validates and reuses this mock instead of creating a new one.",
|
|
134766
134766
|
required: false
|
|
134767
134767
|
},
|
|
134768
|
+
"mock-environment-enabled": {
|
|
134769
|
+
description: "Create or update a dedicated manual-validation environment whose baseUrl is the validated public mock URL. This environment is excluded from runtime CI selection.",
|
|
134770
|
+
required: false,
|
|
134771
|
+
default: "false"
|
|
134772
|
+
},
|
|
134768
134773
|
"monitor-cron": {
|
|
134769
134774
|
description: "Cron expression for monitor scheduling (e.g. '0 */6 * * *'). When empty, the monitor is created disabled and triggered to run once per workflow invocation (and once on every subsequent run).",
|
|
134770
134775
|
required: false,
|
|
@@ -134958,6 +134963,12 @@ var postmanRepoSyncActionContract = {
|
|
|
134958
134963
|
"mock-url": {
|
|
134959
134964
|
description: "Created or reused mock server URL."
|
|
134960
134965
|
},
|
|
134966
|
+
"mock-environment-uid": {
|
|
134967
|
+
description: "Dedicated manual-validation environment UID when mock-environment-enabled succeeds."
|
|
134968
|
+
},
|
|
134969
|
+
"mock-environment-status": {
|
|
134970
|
+
description: "Whether the optional manual-validation mock environment succeeded, was skipped, or failed."
|
|
134971
|
+
},
|
|
134961
134972
|
"monitor-id": {
|
|
134962
134973
|
description: "Created or reused smoke monitor ID."
|
|
134963
134974
|
},
|
|
@@ -136835,6 +136846,7 @@ function resolveInputs(env = process.env) {
|
|
|
136835
136846
|
orgMode: parseBooleanInput(getInput("org-mode", env), false),
|
|
136836
136847
|
monitorId: getInput("monitor-id", env),
|
|
136837
136848
|
mockUrl: getInput("mock-url", env),
|
|
136849
|
+
mockEnvironmentEnabled: parseBooleanInput(getInput("mock-environment-enabled", env), false),
|
|
136838
136850
|
monitorCron: getInput("monitor-cron", env),
|
|
136839
136851
|
sslClientCert: getInput("ssl-client-cert", env),
|
|
136840
136852
|
sslClientKey: getInput("ssl-client-key", env),
|
|
@@ -137061,6 +137073,8 @@ function createOutputs(inputs) {
|
|
|
137061
137073
|
"environment-sync-status": "skipped",
|
|
137062
137074
|
"environment-uids-json": JSON.stringify(inputs.environmentUids),
|
|
137063
137075
|
"mock-url": "",
|
|
137076
|
+
"mock-environment-uid": "",
|
|
137077
|
+
"mock-environment-status": "skipped",
|
|
137064
137078
|
"monitor-id": "",
|
|
137065
137079
|
"repo-sync-summary-json": "{}",
|
|
137066
137080
|
"commit-sha": "",
|
|
@@ -137189,6 +137203,52 @@ async function upsertEnvironments(inputs, dependencies, resourcesState, assetMar
|
|
|
137189
137203
|
}
|
|
137190
137204
|
return envUids;
|
|
137191
137205
|
}
|
|
137206
|
+
async function upsertMockEnvironment(inputs, dependencies, assetProjectName, mockUrl) {
|
|
137207
|
+
if (!inputs.mockEnvironmentEnabled || !inputs.workspaceId || !mockUrl) {
|
|
137208
|
+
return "";
|
|
137209
|
+
}
|
|
137210
|
+
const displayName = `${assetProjectName} - Mock`;
|
|
137211
|
+
const values = buildEnvironmentValues("mock", mockUrl);
|
|
137212
|
+
const mask = resolveRepoSyncMasker(dependencies);
|
|
137213
|
+
try {
|
|
137214
|
+
const discovered = await dependencies.postman.findEnvironmentByName(
|
|
137215
|
+
inputs.workspaceId,
|
|
137216
|
+
displayName
|
|
137217
|
+
);
|
|
137218
|
+
if (discovered?.uid) {
|
|
137219
|
+
try {
|
|
137220
|
+
const existing = await dependencies.postman.getEnvironment(discovered.uid);
|
|
137221
|
+
const currentValues = existing.data?.values ?? existing.values ?? [];
|
|
137222
|
+
if (currentValues.some((value) => value.key === "baseUrl" && value.value === mockUrl)) {
|
|
137223
|
+
dependencies.core.info(`Mock environment already points to ${mockUrl}: ${discovered.uid}`);
|
|
137224
|
+
return discovered.uid;
|
|
137225
|
+
}
|
|
137226
|
+
} catch {
|
|
137227
|
+
}
|
|
137228
|
+
await dependencies.postman.updateEnvironment(discovered.uid, displayName, values);
|
|
137229
|
+
dependencies.core.info(`Updated mock environment ${displayName}: ${discovered.uid}`);
|
|
137230
|
+
return discovered.uid;
|
|
137231
|
+
}
|
|
137232
|
+
const uid = await dependencies.postman.createEnvironment(
|
|
137233
|
+
inputs.workspaceId,
|
|
137234
|
+
displayName,
|
|
137235
|
+
values
|
|
137236
|
+
);
|
|
137237
|
+
dependencies.core.info(`Created mock environment ${displayName}: ${uid}`);
|
|
137238
|
+
return uid;
|
|
137239
|
+
} catch (error) {
|
|
137240
|
+
dependencies.core.warning(
|
|
137241
|
+
formatOrchestrationIssue({
|
|
137242
|
+
operation: "Mock environment upsert",
|
|
137243
|
+
entity: `workspace ${inputs.workspaceId} environment "${displayName}"`,
|
|
137244
|
+
cause: error,
|
|
137245
|
+
remediation: "verify environment access or disable mock-environment-enabled then rerun",
|
|
137246
|
+
mask
|
|
137247
|
+
})
|
|
137248
|
+
);
|
|
137249
|
+
return "";
|
|
137250
|
+
}
|
|
137251
|
+
}
|
|
137192
137252
|
function ensureDir(path5) {
|
|
137193
137253
|
(0, import_node_fs5.mkdirSync)(path5, { recursive: true });
|
|
137194
137254
|
}
|
|
@@ -137827,6 +137887,13 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
137827
137887
|
true
|
|
137828
137888
|
);
|
|
137829
137889
|
}
|
|
137890
|
+
if (options.mockEnvironmentUid) {
|
|
137891
|
+
writeJsonFile(
|
|
137892
|
+
`${mocksDir}/manual-validation.postman_environment.json`,
|
|
137893
|
+
await dependencies.postman.getEnvironment(options.mockEnvironmentUid),
|
|
137894
|
+
true
|
|
137895
|
+
);
|
|
137896
|
+
}
|
|
137830
137897
|
const durableWorkspaceId = resolveDurableWorkspaceId({
|
|
137831
137898
|
candidateId: inputs.workspaceId,
|
|
137832
137899
|
priorId: options.priorWorkspaceId,
|
|
@@ -137885,6 +137952,8 @@ function createRepoSummary(outputs, envUids, pushed) {
|
|
|
137885
137952
|
commitSha: outputs["commit-sha"],
|
|
137886
137953
|
environmentCount: Object.keys(envUids).length,
|
|
137887
137954
|
environmentSyncStatus: outputs["environment-sync-status"],
|
|
137955
|
+
mockEnvironmentStatus: outputs["mock-environment-status"],
|
|
137956
|
+
mockEnvironmentUid: outputs["mock-environment-uid"],
|
|
137888
137957
|
mockUrl: outputs["mock-url"],
|
|
137889
137958
|
monitorId: outputs["monitor-id"],
|
|
137890
137959
|
pushed,
|
|
@@ -138210,6 +138279,20 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
138210
138279
|
}
|
|
138211
138280
|
outputs["mock-url"] = resolvedMockUrl;
|
|
138212
138281
|
dependencies.core.setOutput("mock-url", resolvedMockUrl);
|
|
138282
|
+
if (inputs.mockEnvironmentEnabled && isCanonicalWriter) {
|
|
138283
|
+
const mockEnvironmentUid = await upsertMockEnvironment(
|
|
138284
|
+
inputs,
|
|
138285
|
+
dependencies,
|
|
138286
|
+
assetProjectName,
|
|
138287
|
+
resolvedMockUrl
|
|
138288
|
+
);
|
|
138289
|
+
outputs["mock-environment-uid"] = mockEnvironmentUid;
|
|
138290
|
+
outputs["mock-environment-status"] = mockEnvironmentUid ? "success" : "failed";
|
|
138291
|
+
} else if (inputs.mockEnvironmentEnabled) {
|
|
138292
|
+
dependencies.core.warning(
|
|
138293
|
+
"mock-environment-enabled is skipped for preview and channel runs so manual-validation environments cannot escape branch retention cleanup."
|
|
138294
|
+
);
|
|
138295
|
+
}
|
|
138213
138296
|
}
|
|
138214
138297
|
}
|
|
138215
138298
|
if (inputs.workspaceId && inputs.smokeCollectionId && Object.keys(envUids).length > 0) {
|
|
@@ -138342,6 +138425,7 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
138342
138425
|
workspaceLinkStatus: outputs["workspace-link-status"],
|
|
138343
138426
|
priorWorkspaceId: resourcesState?.workspace?.id,
|
|
138344
138427
|
existingSpecs: resourcesState?.cloudResources?.specs,
|
|
138428
|
+
mockEnvironmentUid: outputs["mock-environment-uid"] || void 0,
|
|
138345
138429
|
releaseLabel,
|
|
138346
138430
|
priorState: resourcesState,
|
|
138347
138431
|
preparedPrebuiltCollections
|
|
@@ -139162,6 +139246,7 @@ var CLI_INPUT_NAMES = [
|
|
|
139162
139246
|
"org-mode",
|
|
139163
139247
|
"monitor-id",
|
|
139164
139248
|
"mock-url",
|
|
139249
|
+
"mock-environment-enabled",
|
|
139165
139250
|
"monitor-cron",
|
|
139166
139251
|
"ssl-client-cert",
|
|
139167
139252
|
"ssl-client-key",
|
package/dist/index.cjs
CHANGED
|
@@ -136682,6 +136682,11 @@ var postmanRepoSyncActionContract = {
|
|
|
136682
136682
|
description: "Existing mock server URL. When set, the action validates and reuses this mock instead of creating a new one.",
|
|
136683
136683
|
required: false
|
|
136684
136684
|
},
|
|
136685
|
+
"mock-environment-enabled": {
|
|
136686
|
+
description: "Create or update a dedicated manual-validation environment whose baseUrl is the validated public mock URL. This environment is excluded from runtime CI selection.",
|
|
136687
|
+
required: false,
|
|
136688
|
+
default: "false"
|
|
136689
|
+
},
|
|
136685
136690
|
"monitor-cron": {
|
|
136686
136691
|
description: "Cron expression for monitor scheduling (e.g. '0 */6 * * *'). When empty, the monitor is created disabled and triggered to run once per workflow invocation (and once on every subsequent run).",
|
|
136687
136692
|
required: false,
|
|
@@ -136875,6 +136880,12 @@ var postmanRepoSyncActionContract = {
|
|
|
136875
136880
|
"mock-url": {
|
|
136876
136881
|
description: "Created or reused mock server URL."
|
|
136877
136882
|
},
|
|
136883
|
+
"mock-environment-uid": {
|
|
136884
|
+
description: "Dedicated manual-validation environment UID when mock-environment-enabled succeeds."
|
|
136885
|
+
},
|
|
136886
|
+
"mock-environment-status": {
|
|
136887
|
+
description: "Whether the optional manual-validation mock environment succeeded, was skipped, or failed."
|
|
136888
|
+
},
|
|
136878
136889
|
"monitor-id": {
|
|
136879
136890
|
description: "Created or reused smoke monitor ID."
|
|
136880
136891
|
},
|
|
@@ -138807,6 +138818,7 @@ function resolveInputs(env = process.env) {
|
|
|
138807
138818
|
orgMode: parseBooleanInput(getInput2("org-mode", env), false),
|
|
138808
138819
|
monitorId: getInput2("monitor-id", env),
|
|
138809
138820
|
mockUrl: getInput2("mock-url", env),
|
|
138821
|
+
mockEnvironmentEnabled: parseBooleanInput(getInput2("mock-environment-enabled", env), false),
|
|
138810
138822
|
monitorCron: getInput2("monitor-cron", env),
|
|
138811
138823
|
sslClientCert: getInput2("ssl-client-cert", env),
|
|
138812
138824
|
sslClientKey: getInput2("ssl-client-key", env),
|
|
@@ -139033,6 +139045,8 @@ function createOutputs(inputs) {
|
|
|
139033
139045
|
"environment-sync-status": "skipped",
|
|
139034
139046
|
"environment-uids-json": JSON.stringify(inputs.environmentUids),
|
|
139035
139047
|
"mock-url": "",
|
|
139048
|
+
"mock-environment-uid": "",
|
|
139049
|
+
"mock-environment-status": "skipped",
|
|
139036
139050
|
"monitor-id": "",
|
|
139037
139051
|
"repo-sync-summary-json": "{}",
|
|
139038
139052
|
"commit-sha": "",
|
|
@@ -139100,6 +139114,7 @@ function readActionInputs(actionCore) {
|
|
|
139100
139114
|
INPUT_ORG_MODE: readInput(actionCore, "org-mode"),
|
|
139101
139115
|
INPUT_MONITOR_ID: readInput(actionCore, "monitor-id"),
|
|
139102
139116
|
INPUT_MOCK_URL: readInput(actionCore, "mock-url"),
|
|
139117
|
+
INPUT_MOCK_ENVIRONMENT_ENABLED: readInput(actionCore, "mock-environment-enabled"),
|
|
139103
139118
|
INPUT_MONITOR_CRON: readInput(actionCore, "monitor-cron"),
|
|
139104
139119
|
INPUT_SSL_CLIENT_CERT: sslClientCert,
|
|
139105
139120
|
INPUT_SSL_CLIENT_KEY: sslClientKey,
|
|
@@ -139301,6 +139316,52 @@ async function upsertEnvironments(inputs, dependencies, resourcesState, assetMar
|
|
|
139301
139316
|
}
|
|
139302
139317
|
return envUids;
|
|
139303
139318
|
}
|
|
139319
|
+
async function upsertMockEnvironment(inputs, dependencies, assetProjectName, mockUrl) {
|
|
139320
|
+
if (!inputs.mockEnvironmentEnabled || !inputs.workspaceId || !mockUrl) {
|
|
139321
|
+
return "";
|
|
139322
|
+
}
|
|
139323
|
+
const displayName = `${assetProjectName} - Mock`;
|
|
139324
|
+
const values = buildEnvironmentValues("mock", mockUrl);
|
|
139325
|
+
const mask = resolveRepoSyncMasker(dependencies);
|
|
139326
|
+
try {
|
|
139327
|
+
const discovered = await dependencies.postman.findEnvironmentByName(
|
|
139328
|
+
inputs.workspaceId,
|
|
139329
|
+
displayName
|
|
139330
|
+
);
|
|
139331
|
+
if (discovered?.uid) {
|
|
139332
|
+
try {
|
|
139333
|
+
const existing = await dependencies.postman.getEnvironment(discovered.uid);
|
|
139334
|
+
const currentValues = existing.data?.values ?? existing.values ?? [];
|
|
139335
|
+
if (currentValues.some((value) => value.key === "baseUrl" && value.value === mockUrl)) {
|
|
139336
|
+
dependencies.core.info(`Mock environment already points to ${mockUrl}: ${discovered.uid}`);
|
|
139337
|
+
return discovered.uid;
|
|
139338
|
+
}
|
|
139339
|
+
} catch {
|
|
139340
|
+
}
|
|
139341
|
+
await dependencies.postman.updateEnvironment(discovered.uid, displayName, values);
|
|
139342
|
+
dependencies.core.info(`Updated mock environment ${displayName}: ${discovered.uid}`);
|
|
139343
|
+
return discovered.uid;
|
|
139344
|
+
}
|
|
139345
|
+
const uid = await dependencies.postman.createEnvironment(
|
|
139346
|
+
inputs.workspaceId,
|
|
139347
|
+
displayName,
|
|
139348
|
+
values
|
|
139349
|
+
);
|
|
139350
|
+
dependencies.core.info(`Created mock environment ${displayName}: ${uid}`);
|
|
139351
|
+
return uid;
|
|
139352
|
+
} catch (error2) {
|
|
139353
|
+
dependencies.core.warning(
|
|
139354
|
+
formatOrchestrationIssue({
|
|
139355
|
+
operation: "Mock environment upsert",
|
|
139356
|
+
entity: `workspace ${inputs.workspaceId} environment "${displayName}"`,
|
|
139357
|
+
cause: error2,
|
|
139358
|
+
remediation: "verify environment access or disable mock-environment-enabled then rerun",
|
|
139359
|
+
mask
|
|
139360
|
+
})
|
|
139361
|
+
);
|
|
139362
|
+
return "";
|
|
139363
|
+
}
|
|
139364
|
+
}
|
|
139304
139365
|
function ensureDir(path9) {
|
|
139305
139366
|
(0, import_node_fs5.mkdirSync)(path9, { recursive: true });
|
|
139306
139367
|
}
|
|
@@ -139939,6 +140000,13 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
139939
140000
|
true
|
|
139940
140001
|
);
|
|
139941
140002
|
}
|
|
140003
|
+
if (options.mockEnvironmentUid) {
|
|
140004
|
+
writeJsonFile(
|
|
140005
|
+
`${mocksDir}/manual-validation.postman_environment.json`,
|
|
140006
|
+
await dependencies.postman.getEnvironment(options.mockEnvironmentUid),
|
|
140007
|
+
true
|
|
140008
|
+
);
|
|
140009
|
+
}
|
|
139942
140010
|
const durableWorkspaceId = resolveDurableWorkspaceId({
|
|
139943
140011
|
candidateId: inputs.workspaceId,
|
|
139944
140012
|
priorId: options.priorWorkspaceId,
|
|
@@ -139997,6 +140065,8 @@ function createRepoSummary(outputs, envUids, pushed) {
|
|
|
139997
140065
|
commitSha: outputs["commit-sha"],
|
|
139998
140066
|
environmentCount: Object.keys(envUids).length,
|
|
139999
140067
|
environmentSyncStatus: outputs["environment-sync-status"],
|
|
140068
|
+
mockEnvironmentStatus: outputs["mock-environment-status"],
|
|
140069
|
+
mockEnvironmentUid: outputs["mock-environment-uid"],
|
|
140000
140070
|
mockUrl: outputs["mock-url"],
|
|
140001
140071
|
monitorId: outputs["monitor-id"],
|
|
140002
140072
|
pushed,
|
|
@@ -140322,6 +140392,20 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140322
140392
|
}
|
|
140323
140393
|
outputs["mock-url"] = resolvedMockUrl;
|
|
140324
140394
|
dependencies.core.setOutput("mock-url", resolvedMockUrl);
|
|
140395
|
+
if (inputs.mockEnvironmentEnabled && isCanonicalWriter) {
|
|
140396
|
+
const mockEnvironmentUid = await upsertMockEnvironment(
|
|
140397
|
+
inputs,
|
|
140398
|
+
dependencies,
|
|
140399
|
+
assetProjectName,
|
|
140400
|
+
resolvedMockUrl
|
|
140401
|
+
);
|
|
140402
|
+
outputs["mock-environment-uid"] = mockEnvironmentUid;
|
|
140403
|
+
outputs["mock-environment-status"] = mockEnvironmentUid ? "success" : "failed";
|
|
140404
|
+
} else if (inputs.mockEnvironmentEnabled) {
|
|
140405
|
+
dependencies.core.warning(
|
|
140406
|
+
"mock-environment-enabled is skipped for preview and channel runs so manual-validation environments cannot escape branch retention cleanup."
|
|
140407
|
+
);
|
|
140408
|
+
}
|
|
140325
140409
|
}
|
|
140326
140410
|
}
|
|
140327
140411
|
if (inputs.workspaceId && inputs.smokeCollectionId && Object.keys(envUids).length > 0) {
|
|
@@ -140454,6 +140538,7 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140454
140538
|
workspaceLinkStatus: outputs["workspace-link-status"],
|
|
140455
140539
|
priorWorkspaceId: resourcesState?.workspace?.id,
|
|
140456
140540
|
existingSpecs: resourcesState?.cloudResources?.specs,
|
|
140541
|
+
mockEnvironmentUid: outputs["mock-environment-uid"] || void 0,
|
|
140457
140542
|
releaseLabel,
|
|
140458
140543
|
priorState: resourcesState,
|
|
140459
140544
|
preparedPrebuiltCollections
|