@postman-cs/onboarding-api 3.4.6
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/LICENSE +21 -0
- package/README.md +409 -0
- package/action.yml +815 -0
- package/package.json +61 -0
- package/scripts/verify-release-artifacts.mjs +155 -0
package/action.yml
ADDED
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
name: Postman API Onboarding
|
|
2
|
+
description: 'Full Postman onboarding in one step: workspace bootstrap, repo sync, and optional Insights linking. Part of the Postman API Onboarding suite.'
|
|
3
|
+
author: Postman
|
|
4
|
+
branding:
|
|
5
|
+
icon: send
|
|
6
|
+
color: orange
|
|
7
|
+
inputs:
|
|
8
|
+
|
|
9
|
+
workspace-id:
|
|
10
|
+
description: Existing Postman workspace ID.
|
|
11
|
+
required: false
|
|
12
|
+
spec-id:
|
|
13
|
+
description: Existing Postman spec ID.
|
|
14
|
+
required: false
|
|
15
|
+
baseline-collection-id:
|
|
16
|
+
description: Existing baseline collection ID.
|
|
17
|
+
required: false
|
|
18
|
+
smoke-collection-id:
|
|
19
|
+
description: Existing smoke collection ID.
|
|
20
|
+
required: false
|
|
21
|
+
contract-collection-id:
|
|
22
|
+
description: Existing contract collection ID.
|
|
23
|
+
required: false
|
|
24
|
+
onboarding-scope:
|
|
25
|
+
description: Onboarding scope. Use full for the complete pipeline or spec-only for workspace/spec onboarding without generated assets.
|
|
26
|
+
required: false
|
|
27
|
+
default: full
|
|
28
|
+
sync-examples:
|
|
29
|
+
description: Whether linked spec/collection relations should enable example syncing.
|
|
30
|
+
required: false
|
|
31
|
+
default: 'true'
|
|
32
|
+
collection-sync-mode:
|
|
33
|
+
description: Collection lifecycle policy (refresh or version). Default refresh ensures tracked collections stay in sync with the spec.
|
|
34
|
+
required: false
|
|
35
|
+
default: refresh
|
|
36
|
+
spec-sync-mode:
|
|
37
|
+
description: Spec lifecycle policy (update or version).
|
|
38
|
+
required: false
|
|
39
|
+
default: update
|
|
40
|
+
release-label:
|
|
41
|
+
description: Optional release label for versioned specs and collections. When omitted during versioned sync, derived from GitHub tag or branch metadata.
|
|
42
|
+
required: false
|
|
43
|
+
monitor-id:
|
|
44
|
+
description: Existing smoke monitor ID. When set, the action validates and reuses this monitor instead of creating a new one.
|
|
45
|
+
required: false
|
|
46
|
+
mock-url:
|
|
47
|
+
description: Existing mock server URL. When set, the action validates and reuses this mock instead of creating a new one.
|
|
48
|
+
required: false
|
|
49
|
+
mock-visibility:
|
|
50
|
+
description: Required mock access policy. Public is anonymous; private requires a runtime x-api-key supplied by the caller and is never persisted by repo-sync.
|
|
51
|
+
required: false
|
|
52
|
+
default: public
|
|
53
|
+
mock-environment-enabled:
|
|
54
|
+
description: Create or update a dedicated manual-validation environment whose baseUrl is the validated mock URL. This environment is excluded from runtime CI selection and never contains a mock credential.
|
|
55
|
+
required: false
|
|
56
|
+
default: "false"
|
|
57
|
+
monitor-cron:
|
|
58
|
+
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).
|
|
59
|
+
required: false
|
|
60
|
+
default: ""
|
|
61
|
+
generate-ci-workflow:
|
|
62
|
+
description: Whether to generate the CI workflow file.
|
|
63
|
+
required: false
|
|
64
|
+
default: "true"
|
|
65
|
+
ci-workflow-path:
|
|
66
|
+
description: Path to write the generated CI workflow file.
|
|
67
|
+
required: false
|
|
68
|
+
default: .github/workflows/ci.yml
|
|
69
|
+
ci-runner-os:
|
|
70
|
+
description: Runner operating system for the generated CI workflow. Use windows for native PowerShell Azure DevOps CI.
|
|
71
|
+
required: false
|
|
72
|
+
default: linux
|
|
73
|
+
project-name:
|
|
74
|
+
description: Service project name used across bootstrap and repo sync phases.
|
|
75
|
+
required: true
|
|
76
|
+
repo-url:
|
|
77
|
+
description: Explicit repository URL forwarded to bootstrap and repo sync. Overrides CI auto-detection when a caller needs an isolated synthetic repository identity.
|
|
78
|
+
required: false
|
|
79
|
+
domain:
|
|
80
|
+
description: Business domain used for governance assignment.
|
|
81
|
+
required: false
|
|
82
|
+
domain-code:
|
|
83
|
+
description: Short domain code used in workspace naming.
|
|
84
|
+
required: false
|
|
85
|
+
governance-group:
|
|
86
|
+
description: Postman governance workspace group name. Overrides the postman-governance-group repository custom property and domain mapping.
|
|
87
|
+
required: false
|
|
88
|
+
requester-email:
|
|
89
|
+
description: Requester email used for workspace membership.
|
|
90
|
+
required: false
|
|
91
|
+
workspace-admin-user-ids:
|
|
92
|
+
description: Comma-separated workspace admin user ids.
|
|
93
|
+
required: false
|
|
94
|
+
workspace-team-id:
|
|
95
|
+
description: >-
|
|
96
|
+
Numeric SUB-TEAM (squad) id that should own the created org-mode workspace.
|
|
97
|
+
Required by the Postman API when the PMAK's team is scoped under a Postman
|
|
98
|
+
organization with multiple sub-teams. This is a squad id, NOT the resolver's
|
|
99
|
+
`team-id` output: that value is a parent/org team id and is never a valid
|
|
100
|
+
value here. On an org account whose squad list is unreadable or unusable,
|
|
101
|
+
bootstrap fails before any workspace is created unless this input is set.
|
|
102
|
+
required: false
|
|
103
|
+
spec-url:
|
|
104
|
+
description: HTTPS URL to the OpenAPI document to bootstrap. Provide either spec-url or spec-path.
|
|
105
|
+
required: false
|
|
106
|
+
spec-path:
|
|
107
|
+
description: Repo-root-relative path to the local spec file. Used for repo metadata generation and, when spec-url is not provided, as the spec source for bootstrap (read directly from the checked-out workspace).
|
|
108
|
+
required: false
|
|
109
|
+
spec-files-json:
|
|
110
|
+
description: >-
|
|
111
|
+
Optional content-free JSON inventory of multi-file definition members from discovery
|
|
112
|
+
(schemaVersion 1). Empty by default. When set, inventory root must equal spec-path.
|
|
113
|
+
Cannot be combined with spec-url. Not a directory mode — companions are listed explicitly;
|
|
114
|
+
file content is never embedded. Forwarded to bootstrap only when spec-url is empty.
|
|
115
|
+
required: false
|
|
116
|
+
default: ''
|
|
117
|
+
preserve-oas30-type-null:
|
|
118
|
+
description: Preserve supported OpenAPI 3.0 type null oneOf members in the uploaded source while using an internal nullable view for validation and generated artifacts.
|
|
119
|
+
required: false
|
|
120
|
+
default: 'false'
|
|
121
|
+
breaking-change-mode:
|
|
122
|
+
description: OpenAPI breaking-change comparison mode passed through to bootstrap (off, pr-native, baseline-only, or previous-spec).
|
|
123
|
+
required: false
|
|
124
|
+
default: 'off'
|
|
125
|
+
breaking-baseline-spec-path:
|
|
126
|
+
description: Repo-root-relative baseline OpenAPI spec path used by bootstrap baseline-only mode and pr-native fallback.
|
|
127
|
+
required: false
|
|
128
|
+
breaking-rules-path:
|
|
129
|
+
description: Repo-root-relative openapi-changes rules file passed through to bootstrap. Missing files are ignored.
|
|
130
|
+
required: false
|
|
131
|
+
default: changes-rules.yaml
|
|
132
|
+
breaking-target-ref:
|
|
133
|
+
description: Optional target branch or git ref override for bootstrap pr-native breaking-change comparisons.
|
|
134
|
+
required: false
|
|
135
|
+
breaking-summary-path:
|
|
136
|
+
description: Optional markdown breaking-change report path. Defaults to a bootstrap runner-temp file.
|
|
137
|
+
required: false
|
|
138
|
+
default: ''
|
|
139
|
+
breaking-log-path:
|
|
140
|
+
description: Optional raw breaking-change log path. Defaults to a bootstrap runner-temp file.
|
|
141
|
+
required: false
|
|
142
|
+
default: ''
|
|
143
|
+
environments-json:
|
|
144
|
+
description: JSON array of environment slugs to materialize.
|
|
145
|
+
required: false
|
|
146
|
+
default: '["prod"]'
|
|
147
|
+
system-env-map-json:
|
|
148
|
+
description: JSON map of environment slug to system environment id.
|
|
149
|
+
required: false
|
|
150
|
+
default: '{}'
|
|
151
|
+
environment-uids-json:
|
|
152
|
+
description: JSON map of environment slug to existing Postman environment UID. When provided, repo-sync reuses these environments instead of creating new ones.
|
|
153
|
+
required: false
|
|
154
|
+
default: '{}'
|
|
155
|
+
governance-mapping-json:
|
|
156
|
+
description: JSON map of business domain to governance group name.
|
|
157
|
+
required: false
|
|
158
|
+
default: '{}'
|
|
159
|
+
env-runtime-urls-json:
|
|
160
|
+
description: JSON map of environment slug to runtime base URL.
|
|
161
|
+
required: false
|
|
162
|
+
default: '{}'
|
|
163
|
+
postman-api-key:
|
|
164
|
+
description: Postman API key (PMAK). Threaded to the wrapped actions to mint and re-mint the access token and to authenticate the Postman CLI logins (bootstrap spec lint, repo-sync generated-CI collection run). Individually optional; at least one of postman-api-key or postman-access-token is required.
|
|
165
|
+
required: false
|
|
166
|
+
postman-access-token:
|
|
167
|
+
description: Postman access token (x-access-token). Primary credential threaded to the wrapped actions; every Postman asset operation runs through the access-token gateway. Mint it with postman-resolve-service-token-action. Individually optional; at least one of postman-api-key or postman-access-token is required.
|
|
168
|
+
required: false
|
|
169
|
+
insights-postman-api-key:
|
|
170
|
+
description: Human-user Postman API key (PMAK) for Insights. Required with insights-postman-access-token only when enable-insights is true and onboarding-scope is full; do not use the service-account suite key.
|
|
171
|
+
required: false
|
|
172
|
+
insights-postman-access-token:
|
|
173
|
+
description: Human-user session access token for Insights. Required with insights-postman-api-key only when enable-insights is true and onboarding-scope is full; do not use a service-token mint.
|
|
174
|
+
required: false
|
|
175
|
+
credential-preflight:
|
|
176
|
+
description: "Credential identity preflight policy forwarded to bootstrap and repo sync. warn (default) logs a note and continues when postman-api-key and postman-access-token resolve to different parent orgs; enforce fails the run on that condition before any workspace is created."
|
|
177
|
+
required: false
|
|
178
|
+
default: warn
|
|
179
|
+
branch-strategy:
|
|
180
|
+
description: Branch-aware sync strategy. v2 preserves legacy by default; the future v3 major will default to publish-gate after its release gates close.
|
|
181
|
+
required: false
|
|
182
|
+
default: legacy
|
|
183
|
+
canonical-branch:
|
|
184
|
+
description: Explicit canonical branch. Defaults to the GitHub event repository default branch for non-legacy strategies.
|
|
185
|
+
required: false
|
|
186
|
+
channels:
|
|
187
|
+
description: Comma-separated channel map, for example develop=DEV, staging=STAGE, release/*=RC.
|
|
188
|
+
required: false
|
|
189
|
+
preview-ttl:
|
|
190
|
+
description: Sliding preview retention TTL in days, forwarded to repo-sync.
|
|
191
|
+
required: false
|
|
192
|
+
default: '30'
|
|
193
|
+
postman-team-id:
|
|
194
|
+
description: Explicit Postman team ID override for org-mode integration calls.
|
|
195
|
+
required: false
|
|
196
|
+
postman-region:
|
|
197
|
+
description: Postman data residency region for public API and Postman CLI calls. One of us or eu.
|
|
198
|
+
required: false
|
|
199
|
+
default: us
|
|
200
|
+
postman-stack:
|
|
201
|
+
description: 'Postman stack profile. Use prod for Marketplace workflows; EU data residency requires prod.'
|
|
202
|
+
required: false
|
|
203
|
+
default: prod
|
|
204
|
+
github-token:
|
|
205
|
+
description: GitHub token used for repo variables and generated commits.
|
|
206
|
+
required: false
|
|
207
|
+
gh-fallback-token:
|
|
208
|
+
description: Fallback GitHub token for variable and workflow-file APIs.
|
|
209
|
+
required: false
|
|
210
|
+
repo-write-mode:
|
|
211
|
+
description: Repo mutation mode for generated assets and workflow files. One of none, commit-only, or commit-and-push.
|
|
212
|
+
required: false
|
|
213
|
+
default: commit-and-push
|
|
214
|
+
current-ref:
|
|
215
|
+
description: Explicit ref override for detached checkout push semantics.
|
|
216
|
+
required: false
|
|
217
|
+
committer-name:
|
|
218
|
+
description: Commit author name for generated sync commits.
|
|
219
|
+
required: false
|
|
220
|
+
default: Postman
|
|
221
|
+
committer-email:
|
|
222
|
+
description: Commit author email for generated sync commits.
|
|
223
|
+
required: false
|
|
224
|
+
default: support@postman.com
|
|
225
|
+
flow-path:
|
|
226
|
+
description: |
|
|
227
|
+
Optional repo-root-relative path to the smoke flow.yaml manifest,
|
|
228
|
+
defaulting to postman/flow.yaml inside the wrapped action. When set, the
|
|
229
|
+
composite chains postman-cs/postman-smoke-flow-action before repo sync:
|
|
230
|
+
a manifest at the effective path drives a curated reshape of the
|
|
231
|
+
canonical Smoke collection, and under flow-mode auto a missing manifest
|
|
232
|
+
is derived from spec-path and persisted to that path so repo sync
|
|
233
|
+
commits it and the next run takes the curated path. Leave empty
|
|
234
|
+
(default) to skip the smoke-flow step unless flow-mode requests it.
|
|
235
|
+
required: false
|
|
236
|
+
default: ''
|
|
237
|
+
flow-mode:
|
|
238
|
+
description: |
|
|
239
|
+
Optional flow selection policy forwarded to postman-cs/postman-smoke-flow-action.
|
|
240
|
+
Set to auto to run the smoke-flow step without a curated manifest: it
|
|
241
|
+
derives a deterministic smoke flow from spec-path (create before read,
|
|
242
|
+
output-to-input bindings resolved by provenance) and persists it to the
|
|
243
|
+
effective flow path for repo sync to commit. Set to curated to require
|
|
244
|
+
flow-path, or off to refresh the canonical Smoke collection without
|
|
245
|
+
curation. Leave empty (default) to run the smoke-flow step only when
|
|
246
|
+
flow-path is set, preserving the pre-flow-mode contract.
|
|
247
|
+
required: false
|
|
248
|
+
default: ''
|
|
249
|
+
flow-allow-delete:
|
|
250
|
+
description: |
|
|
251
|
+
Whether a derived smoke flow may include DELETE operations whose
|
|
252
|
+
identifiers are proven to originate from the same run's create steps.
|
|
253
|
+
Forwarded to postman-cs/postman-smoke-flow-action; ignored for curated
|
|
254
|
+
manifests. Defaults to false.
|
|
255
|
+
required: false
|
|
256
|
+
default: 'false'
|
|
257
|
+
persist-derived-flow:
|
|
258
|
+
description: |
|
|
259
|
+
Whether a freshly derived smoke flow is written to the effective flow
|
|
260
|
+
path (flow-path or postman/flow.yaml) after a successful apply, so repo
|
|
261
|
+
sync commits it and the next run is curated. Forwarded to
|
|
262
|
+
postman-cs/postman-smoke-flow-action; create-only, never overwrites an
|
|
263
|
+
existing manifest. Set false to derive without persisting.
|
|
264
|
+
required: false
|
|
265
|
+
default: 'true'
|
|
266
|
+
enable-insights:
|
|
267
|
+
description: Whether to enable Postman Insights.
|
|
268
|
+
required: false
|
|
269
|
+
default: 'false'
|
|
270
|
+
skip-built-in-tests:
|
|
271
|
+
description: |
|
|
272
|
+
When 'true', skip the built-in smoke and contract Postman CLI test run
|
|
273
|
+
and JUnit artifact upload that normally happen inside this action. Set
|
|
274
|
+
this to 'true' when the caller workflow needs to perform additional
|
|
275
|
+
post-onboarding setup (e.g. bearer-token injection, mTLS bootstrap,
|
|
276
|
+
vault-hydrated secrets, dynamic env enrichment) before the smoke and
|
|
277
|
+
contract suites can authenticate successfully, and will run the tests
|
|
278
|
+
itself afterward. Default 'false' preserves existing behavior for all
|
|
279
|
+
current callers.
|
|
280
|
+
required: false
|
|
281
|
+
default: 'false'
|
|
282
|
+
cluster-name:
|
|
283
|
+
description: Insights cluster name passed to the downstream Insights onboarding step.
|
|
284
|
+
required: false
|
|
285
|
+
integration-backend:
|
|
286
|
+
description: Advanced/internal. Integration backend used to coordinate onboarding phases; leave unset to use the default.
|
|
287
|
+
required: false
|
|
288
|
+
org-mode:
|
|
289
|
+
description: Whether the Postman team uses org-mode. When true, x-entity-team-id is included on integration calls. Non-org teams must omit this header.
|
|
290
|
+
required: false
|
|
291
|
+
default: 'false'
|
|
292
|
+
ssl-client-cert:
|
|
293
|
+
description: Base64-encoded PEM client certificate for mTLS. Passed through to repo-sync for CI workflow generation.
|
|
294
|
+
required: false
|
|
295
|
+
ssl-client-key:
|
|
296
|
+
description: Base64-encoded PEM client private key. Passed through to repo-sync.
|
|
297
|
+
required: false
|
|
298
|
+
ssl-client-passphrase:
|
|
299
|
+
description: Passphrase for encrypted private key. Passed through to repo-sync.
|
|
300
|
+
required: false
|
|
301
|
+
ssl-extra-ca-certs:
|
|
302
|
+
description: Base64-encoded PEM additional CA certificates. Passed through to repo-sync.
|
|
303
|
+
required: false
|
|
304
|
+
outputs:
|
|
305
|
+
integration-backend:
|
|
306
|
+
description: Resolved integration backend for the onboarding run.
|
|
307
|
+
value: ${{ inputs.integration-backend }}
|
|
308
|
+
workspace-id:
|
|
309
|
+
description: Postman workspace ID.
|
|
310
|
+
value: ${{ steps.bootstrap.outputs.workspace-id }}
|
|
311
|
+
workspace-url:
|
|
312
|
+
description: Postman workspace URL.
|
|
313
|
+
value: ${{ steps.bootstrap.outputs.workspace-url }}
|
|
314
|
+
spec-id:
|
|
315
|
+
description: Uploaded Postman spec ID.
|
|
316
|
+
value: ${{ steps.bootstrap.outputs.spec-id }}
|
|
317
|
+
collections-json:
|
|
318
|
+
description: JSON summary of generated collections.
|
|
319
|
+
value: ${{ steps.bootstrap.outputs.collections-json }}
|
|
320
|
+
breaking-change-status:
|
|
321
|
+
description: OpenAPI breaking-change check status from bootstrap.
|
|
322
|
+
value: ${{ steps.bootstrap.outputs.breaking-change-status }}
|
|
323
|
+
breaking-change-summary-json:
|
|
324
|
+
description: JSON summary of the OpenAPI breaking-change check from bootstrap.
|
|
325
|
+
value: ${{ steps.bootstrap.outputs.breaking-change-summary-json }}
|
|
326
|
+
environment-uids-json:
|
|
327
|
+
description: JSON map of environment slug to Postman environment uid.
|
|
328
|
+
value: ${{ steps.repo_sync.outputs.environment-uids-json }}
|
|
329
|
+
mock-url:
|
|
330
|
+
description: Mock server URL.
|
|
331
|
+
value: ${{ steps.repo_sync.outputs.mock-url }}
|
|
332
|
+
mock-visibility:
|
|
333
|
+
description: 'Authoritatively observed mock visibility: public or private.'
|
|
334
|
+
value: ${{ steps.repo_sync.outputs.mock-visibility }}
|
|
335
|
+
mock-auth-required:
|
|
336
|
+
description: Whether the collection runner must supply postmanPrivateMockApiKey at runtime.
|
|
337
|
+
value: ${{ steps.repo_sync.outputs.mock-auth-required }}
|
|
338
|
+
mock-environment-uid:
|
|
339
|
+
description: Dedicated manual-validation environment UID when mock-environment-enabled succeeds.
|
|
340
|
+
value: ${{ steps.repo_sync.outputs.mock-environment-uid }}
|
|
341
|
+
mock-environment-status:
|
|
342
|
+
description: Whether the optional manual-validation mock environment succeeded, was skipped, or failed.
|
|
343
|
+
value: ${{ steps.repo_sync.outputs.mock-environment-status }}
|
|
344
|
+
monitor-id:
|
|
345
|
+
description: Smoke monitor ID.
|
|
346
|
+
value: ${{ steps.repo_sync.outputs.monitor-id }}
|
|
347
|
+
repo-sync-summary-json:
|
|
348
|
+
description: JSON summary of repo materialization and workspace sync planning.
|
|
349
|
+
value: ${{ steps.repo_sync.outputs.repo-sync-summary-json }}
|
|
350
|
+
commit-sha:
|
|
351
|
+
description: Commit SHA produced by repo-write-mode.
|
|
352
|
+
value: ${{ steps.repo_sync.outputs.commit-sha }}
|
|
353
|
+
sync-status:
|
|
354
|
+
description: Branch-aware sync status, including skipped-branch-gate for credential-free gated runs.
|
|
355
|
+
value: ${{ steps.repo_sync.outputs.sync-status || steps.bootstrap.outputs.sync-status }}
|
|
356
|
+
spec-version-url:
|
|
357
|
+
description: Read-only URL for the canonical Spec Hub version finalized by repo-sync.
|
|
358
|
+
value: ${{ steps.repo_sync.outputs.spec-version-url }}
|
|
359
|
+
flow-apply-status:
|
|
360
|
+
description: Smoke-flow apply result status (empty when the smoke-flow step did not run).
|
|
361
|
+
value: ${{ steps.smoke_flow.outputs.flow-apply-status }}
|
|
362
|
+
flow-apply-summary-json:
|
|
363
|
+
description: JSON summary of smoke-flow application results and warnings (empty when the smoke-flow step did not run).
|
|
364
|
+
value: ${{ steps.smoke_flow.outputs.flow-apply-summary-json }}
|
|
365
|
+
derived-flow-path:
|
|
366
|
+
description: Repo-relative path where the smoke-flow step persisted a derived flow.yaml this run (empty for curated manifests, persistence opt-out, uncurated refreshes, and skipped runs). The reordered repo-sync step commits the file with the rest of the postman tree.
|
|
367
|
+
value: ${{ steps.smoke_flow.outputs.derived-flow-path }}
|
|
368
|
+
bootstrap-outcome:
|
|
369
|
+
description: GitHub Actions runner outcome for the bootstrap step.
|
|
370
|
+
value: ${{ steps.bootstrap.outcome }}
|
|
371
|
+
repo-sync-outcome:
|
|
372
|
+
description: GitHub Actions runner outcome for the repo sync step.
|
|
373
|
+
value: ${{ steps.repo_sync.outcome }}
|
|
374
|
+
smoke-flow-outcome:
|
|
375
|
+
description: GitHub Actions runner outcome for the smoke-flow step (skipped when neither flow-path nor flow-mode is set).
|
|
376
|
+
value: ${{ steps.smoke_flow.outcome }}
|
|
377
|
+
insights-outcome:
|
|
378
|
+
description: GitHub Actions runner outcome for the Insights onboarding step.
|
|
379
|
+
value: ${{ steps.insights_onboarding.outcome }}
|
|
380
|
+
insights-status:
|
|
381
|
+
description: Insights onboarding status (success, not-found, error, or empty if insights disabled).
|
|
382
|
+
value: ${{ steps.insights_onboarding.outputs.status }}
|
|
383
|
+
insights-verification-token:
|
|
384
|
+
description: Team verification token for Insights DaemonSet configuration.
|
|
385
|
+
value: ${{ steps.insights_onboarding.outputs.verification-token }}
|
|
386
|
+
insights-application-id:
|
|
387
|
+
description: Insights application binding ID.
|
|
388
|
+
value: ${{ steps.insights_onboarding.outputs.application-id }}
|
|
389
|
+
insights-discovered-service-id:
|
|
390
|
+
description: Discovered service ID from Insights agent.
|
|
391
|
+
value: ${{ steps.insights_onboarding.outputs.discovered-service-id }}
|
|
392
|
+
insights-discovered-service-name:
|
|
393
|
+
description: Discovered service name from Insights agent.
|
|
394
|
+
value: ${{ steps.insights_onboarding.outputs.discovered-service-name }}
|
|
395
|
+
insights-collection-id:
|
|
396
|
+
description: Insights API Catalog collection ID.
|
|
397
|
+
value: ${{ steps.insights_onboarding.outputs.collection-id }}
|
|
398
|
+
runs:
|
|
399
|
+
using: composite
|
|
400
|
+
steps:
|
|
401
|
+
- id: branch_decision
|
|
402
|
+
name: Resolve immutable branch decision
|
|
403
|
+
shell: bash
|
|
404
|
+
env:
|
|
405
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
406
|
+
BRANCH_STRATEGY: ${{ inputs.branch-strategy }}
|
|
407
|
+
CANONICAL_BRANCH: ${{ inputs.canonical-branch }}
|
|
408
|
+
CHANNELS: ${{ inputs.channels }}
|
|
409
|
+
run: |
|
|
410
|
+
node <<'NODE'
|
|
411
|
+
const fs = require('node:fs');
|
|
412
|
+
const clean = (value) => (value || '').trim() || undefined;
|
|
413
|
+
const strategy = clean(process.env.BRANCH_STRATEGY) || 'legacy';
|
|
414
|
+
if (!['legacy', 'publish-gate', 'preview'].includes(strategy)) throw new Error('CONTRACT_BRANCH_STRATEGY_INVALID: expected legacy, publish-gate, or preview');
|
|
415
|
+
let event = {};
|
|
416
|
+
try { event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8')); } catch {}
|
|
417
|
+
const rawRef = clean(process.env.GITHUB_REF) || clean(process.env.GITHUB_REF_NAME);
|
|
418
|
+
const headBranch = clean(process.env.GITHUB_HEAD_REF) || (rawRef?.startsWith('refs/heads/') ? rawRef.slice(11) : undefined);
|
|
419
|
+
const defaultBranch = clean(process.env.CANONICAL_BRANCH) || clean(event.repository?.default_branch);
|
|
420
|
+
const isPrContext = Boolean(clean(process.env.GITHUB_HEAD_REF));
|
|
421
|
+
const headRepo = event.pull_request?.head?.repo?.full_name;
|
|
422
|
+
const baseRepo = event.pull_request?.base?.repo?.full_name || event.repository?.full_name;
|
|
423
|
+
const isForkPr = Boolean(headRepo && baseRepo && headRepo !== baseRepo);
|
|
424
|
+
let refKind = rawRef?.startsWith('refs/tags/') ? 'tag' : headBranch ? 'branch' : 'unknown';
|
|
425
|
+
if (headBranch && defaultBranch && headBranch === defaultBranch) refKind = 'default-branch';
|
|
426
|
+
const identity = { provider: 'github', headBranch, rawRef, defaultBranch, refKind, isPrContext, isForkPr, headSha: clean(process.env.GITHUB_SHA) };
|
|
427
|
+
const canonicalBranch = clean(process.env.CANONICAL_BRANCH) || defaultBranch;
|
|
428
|
+
let tier = 'legacy';
|
|
429
|
+
let reason = 'branch-strategy legacy: branch-blind pre-v2 behavior';
|
|
430
|
+
let channel;
|
|
431
|
+
if (strategy !== 'legacy') {
|
|
432
|
+
if (!canonicalBranch) throw new Error('CONTRACT_DEFAULT_BRANCH_UNRESOLVED: set the canonical-branch input');
|
|
433
|
+
const rules = (clean(process.env.CHANNELS)?.split(',') || []).filter(Boolean).map((entry) => {
|
|
434
|
+
const parts = entry.split('=').map((part) => part.trim());
|
|
435
|
+
if (parts.length !== 2 || !parts[0] || !/^[A-Za-z][A-Za-z0-9_-]{0,15}$/.test(parts[1])) throw new Error(`CONTRACT_CHANNELS_INPUT_INVALID: ${entry}`);
|
|
436
|
+
return { pattern: parts[0], code: parts[1].toUpperCase() };
|
|
437
|
+
});
|
|
438
|
+
if (!rules.some((rule) => rule.pattern === 'release/*')) rules.push({ pattern: 'release/*', code: 'RC' });
|
|
439
|
+
channel = rules.find((rule) => rule.pattern.endsWith('*') ? headBranch?.startsWith(rule.pattern.slice(0, -1)) : headBranch === rule.pattern);
|
|
440
|
+
if (refKind === 'tag' || refKind === 'unknown' || !headBranch) { tier = 'gated'; reason = `ref kind ${refKind}: no-op`; }
|
|
441
|
+
else if (headBranch === canonicalBranch) { tier = 'canonical'; reason = `head branch equals canonical branch ${canonicalBranch}`; }
|
|
442
|
+
else if (channel) { tier = 'channel'; reason = `branch ${headBranch} matches channel ${channel.pattern}=${channel.code}`; }
|
|
443
|
+
else if (strategy === 'preview' && !isForkPr) { tier = 'preview'; reason = `branch ${headBranch} under branch-strategy preview`; }
|
|
444
|
+
else { tier = 'gated'; reason = isForkPr ? 'fork PR: preview-ineligible, gated instead' : `branch ${headBranch} under branch-strategy publish-gate`; }
|
|
445
|
+
}
|
|
446
|
+
const decision = { tier, strategy, identity, canonicalBranch, ...(channel && tier === 'channel' ? { channel } : {}), reason };
|
|
447
|
+
const serialized = JSON.stringify(decision);
|
|
448
|
+
fs.appendFileSync(process.env.GITHUB_OUTPUT, `tier=${tier}\nbranch-decision=${serialized}\n`);
|
|
449
|
+
fs.appendFileSync(process.env.GITHUB_ENV, `POSTMAN_BRANCH_DECISION=${serialized}\n`);
|
|
450
|
+
NODE
|
|
451
|
+
- id: validate_postman_stack
|
|
452
|
+
name: Validate Postman stack and region
|
|
453
|
+
shell: bash
|
|
454
|
+
env:
|
|
455
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
456
|
+
POSTMAN_REGION: ${{ inputs.postman-region }}
|
|
457
|
+
POSTMAN_STACK: ${{ inputs.postman-stack }}
|
|
458
|
+
CREDENTIAL_PREFLIGHT: ${{ inputs.credential-preflight }}
|
|
459
|
+
REPO_WRITE_MODE: ${{ inputs.repo-write-mode }}
|
|
460
|
+
POSTMAN_API_KEY: ${{ inputs.postman-api-key }}
|
|
461
|
+
POSTMAN_ACCESS_TOKEN: ${{ inputs.postman-access-token }}
|
|
462
|
+
ENABLE_INSIGHTS: ${{ inputs.enable-insights }}
|
|
463
|
+
ONBOARDING_SCOPE: ${{ inputs.onboarding-scope }}
|
|
464
|
+
BRANCH_TIER: ${{ steps.branch_decision.outputs.tier }}
|
|
465
|
+
INSIGHTS_POSTMAN_API_KEY: ${{ inputs.insights-postman-api-key }}
|
|
466
|
+
INSIGHTS_POSTMAN_ACCESS_TOKEN: ${{ inputs.insights-postman-access-token }}
|
|
467
|
+
run: |
|
|
468
|
+
case "$POSTMAN_STACK" in
|
|
469
|
+
prod|beta) ;;
|
|
470
|
+
*)
|
|
471
|
+
echo "::error::Attempted postman-stack validation failed: the provided value is unsupported. Accepted values: prod, beta. Set the postman-stack input to one of those values."
|
|
472
|
+
exit 1
|
|
473
|
+
;;
|
|
474
|
+
esac
|
|
475
|
+
case "$POSTMAN_REGION" in
|
|
476
|
+
us|eu) ;;
|
|
477
|
+
*)
|
|
478
|
+
echo "::error::Attempted postman-region validation failed: the provided value is unsupported. Accepted values: us, eu. Set the postman-region input to one of those values."
|
|
479
|
+
exit 1
|
|
480
|
+
;;
|
|
481
|
+
esac
|
|
482
|
+
if [ "$POSTMAN_STACK" = "beta" ] && [ "$POSTMAN_REGION" = "eu" ]; then
|
|
483
|
+
echo "::error::postman-region=eu is only supported with postman-stack=prod."
|
|
484
|
+
exit 1
|
|
485
|
+
fi
|
|
486
|
+
case "$CREDENTIAL_PREFLIGHT" in
|
|
487
|
+
warn|enforce) ;;
|
|
488
|
+
*)
|
|
489
|
+
echo "::error::Attempted credential-preflight validation failed: the provided value is unsupported. Accepted values: warn, enforce. Set the credential-preflight input to one of those values."
|
|
490
|
+
exit 1
|
|
491
|
+
;;
|
|
492
|
+
esac
|
|
493
|
+
case "$REPO_WRITE_MODE" in
|
|
494
|
+
none|commit-only|commit-and-push) ;;
|
|
495
|
+
*)
|
|
496
|
+
echo "::error::Attempted repo-write-mode validation failed: the provided value is unsupported. Accepted values: none, commit-only, commit-and-push. Set the repo-write-mode input to one of those values."
|
|
497
|
+
exit 1
|
|
498
|
+
;;
|
|
499
|
+
esac
|
|
500
|
+
if [ "$BRANCH_TIER" != "gated" ] && [ -z "$POSTMAN_API_KEY" ] && [ -z "$POSTMAN_ACCESS_TOKEN" ]; then
|
|
501
|
+
echo "::error::Attempted onboarding credential validation failed: neither postman-api-key nor postman-access-token was supplied. Provide one of those inputs and rerun."
|
|
502
|
+
exit 1
|
|
503
|
+
fi
|
|
504
|
+
case "$ONBOARDING_SCOPE" in
|
|
505
|
+
full|spec-only) ;;
|
|
506
|
+
*)
|
|
507
|
+
echo "::error::Attempted onboarding-scope validation failed: the provided value is unsupported. Accepted values: full, spec-only. Set the onboarding-scope input to one of those values."
|
|
508
|
+
exit 1
|
|
509
|
+
;;
|
|
510
|
+
esac
|
|
511
|
+
if [ "$ONBOARDING_SCOPE" = "full" ] && [ "$ENABLE_INSIGHTS" = "true" ] && { [ -z "$INSIGHTS_POSTMAN_API_KEY" ] || [ -z "$INSIGHTS_POSTMAN_ACCESS_TOKEN" ]; }; then
|
|
512
|
+
echo "::error::Attempted Insights credential validation failed: both insights-postman-api-key and insights-postman-access-token are required when enable-insights=true. Provide human-user credentials and rerun."
|
|
513
|
+
exit 1
|
|
514
|
+
fi
|
|
515
|
+
- id: bootstrap
|
|
516
|
+
name: Bootstrap Postman Assets
|
|
517
|
+
uses: postman-cs/postman-bootstrap-action@v2.20.0
|
|
518
|
+
env:
|
|
519
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
520
|
+
POSTMAN_BRANCH_DECISION: ${{ steps.branch_decision.outputs.branch-decision }}
|
|
521
|
+
# Bootstrap v2.17.1 reads this normalized env key through its exported
|
|
522
|
+
# getInput('repo-url') seam, while its action metadata does not declare a
|
|
523
|
+
# nested with-key. Keep the composite input explicit without violating
|
|
524
|
+
# the pinned child metadata contract.
|
|
525
|
+
INPUT_REPO_URL: ${{ inputs.repo-url }}
|
|
526
|
+
with:
|
|
527
|
+
project-name: ${{ inputs.project-name }}
|
|
528
|
+
workspace-id: ${{ inputs.workspace-id }}
|
|
529
|
+
spec-id: ${{ inputs.spec-id }}
|
|
530
|
+
baseline-collection-id: ${{ inputs.baseline-collection-id }}
|
|
531
|
+
smoke-collection-id: ${{ inputs.smoke-collection-id }}
|
|
532
|
+
contract-collection-id: ${{ inputs.contract-collection-id }}
|
|
533
|
+
onboarding-scope: ${{ inputs.onboarding-scope }}
|
|
534
|
+
sync-examples: ${{ inputs.sync-examples }}
|
|
535
|
+
collection-sync-mode: ${{ inputs.collection-sync-mode }}
|
|
536
|
+
spec-sync-mode: ${{ inputs.spec-sync-mode }}
|
|
537
|
+
release-label: ${{ inputs.release-label }}
|
|
538
|
+
domain: ${{ inputs.domain }}
|
|
539
|
+
domain-code: ${{ inputs.domain-code }}
|
|
540
|
+
governance-group: ${{ inputs.governance-group }}
|
|
541
|
+
requester-email: ${{ inputs.requester-email }}
|
|
542
|
+
workspace-admin-user-ids: ${{ inputs.workspace-admin-user-ids }}
|
|
543
|
+
workspace-team-id: ${{ inputs.workspace-team-id }}
|
|
544
|
+
spec-url: ${{ inputs.spec-url }}
|
|
545
|
+
# Only forward spec-path to bootstrap when spec-url is empty so that
|
|
546
|
+
# legacy callers passing both (spec-url for bootstrap, spec-path for
|
|
547
|
+
# repo metadata) keep working under the bootstrap action's one-of
|
|
548
|
+
# contract.
|
|
549
|
+
spec-path: ${{ inputs.spec-url == '' && inputs.spec-path || '' }}
|
|
550
|
+
# Same URL precedence for inventory: local path only; blank when
|
|
551
|
+
# spec-url is non-empty so legacy dual callers remain unchanged.
|
|
552
|
+
spec-files-json: ${{ inputs.spec-url == '' && inputs.spec-files-json || '' }}
|
|
553
|
+
preserve-oas30-type-null: ${{ inputs.preserve-oas30-type-null }}
|
|
554
|
+
breaking-change-mode: ${{ inputs.breaking-change-mode }}
|
|
555
|
+
breaking-baseline-spec-path: ${{ inputs.breaking-baseline-spec-path }}
|
|
556
|
+
breaking-rules-path: ${{ inputs.breaking-rules-path }}
|
|
557
|
+
breaking-target-ref: ${{ inputs.breaking-target-ref }}
|
|
558
|
+
breaking-summary-path: ${{ inputs.breaking-summary-path }}
|
|
559
|
+
breaking-log-path: ${{ inputs.breaking-log-path }}
|
|
560
|
+
governance-mapping-json: ${{ inputs.governance-mapping-json }}
|
|
561
|
+
github-token: ${{ inputs.github-token }}
|
|
562
|
+
gh-fallback-token: ${{ inputs.gh-fallback-token }}
|
|
563
|
+
postman-api-key: ${{ steps.branch_decision.outputs.tier != 'gated' && inputs.postman-api-key || '' }}
|
|
564
|
+
postman-access-token: ${{ steps.branch_decision.outputs.tier != 'gated' && inputs.postman-access-token || '' }}
|
|
565
|
+
credential-preflight: ${{ inputs.credential-preflight }}
|
|
566
|
+
branch-strategy: ${{ inputs.branch-strategy }}
|
|
567
|
+
canonical-branch: ${{ inputs.canonical-branch }}
|
|
568
|
+
channels: ${{ inputs.channels }}
|
|
569
|
+
integration-backend: ${{ inputs.integration-backend }}
|
|
570
|
+
postman-region: ${{ inputs.postman-region }}
|
|
571
|
+
postman-stack: ${{ inputs.postman-stack }}
|
|
572
|
+
- id: smoke_flow
|
|
573
|
+
name: Apply Smoke flow
|
|
574
|
+
if: ${{ inputs.onboarding-scope == 'full' && (inputs.flow-path != '' || inputs.flow-mode != '') && steps.branch_decision.outputs.tier != 'gated' }}
|
|
575
|
+
uses: postman-cs/postman-smoke-flow-action@v3.6.0
|
|
576
|
+
env:
|
|
577
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
578
|
+
POSTMAN_BRANCH_DECISION: ${{ steps.branch_decision.outputs.branch-decision }}
|
|
579
|
+
with:
|
|
580
|
+
project-name: ${{ inputs.project-name }}
|
|
581
|
+
workspace-id: ${{ steps.bootstrap.outputs.workspace-id }}
|
|
582
|
+
spec-id: ${{ steps.bootstrap.outputs.spec-id }}
|
|
583
|
+
smoke-collection-id: ${{ steps.bootstrap.outputs.smoke-collection-id }}
|
|
584
|
+
flow-path: ${{ inputs.flow-path }}
|
|
585
|
+
flow-mode: ${{ inputs.flow-mode == '' && 'auto' || inputs.flow-mode }}
|
|
586
|
+
flow-allow-delete: ${{ inputs.flow-allow-delete }}
|
|
587
|
+
persist-derived-flow: ${{ inputs.persist-derived-flow }}
|
|
588
|
+
spec-path: ${{ inputs.spec-path }}
|
|
589
|
+
postman-api-key: ${{ inputs.postman-api-key }}
|
|
590
|
+
postman-access-token: ${{ inputs.postman-access-token }}
|
|
591
|
+
postman-region: ${{ inputs.postman-region }}
|
|
592
|
+
team-id: ${{ inputs.postman-team-id }}
|
|
593
|
+
branch-strategy: ${{ inputs.branch-strategy }}
|
|
594
|
+
canonical-branch: ${{ inputs.canonical-branch }}
|
|
595
|
+
channels: ${{ inputs.channels }}
|
|
596
|
+
- id: repo_sync
|
|
597
|
+
name: Sync Repository and Workspace
|
|
598
|
+
if: ${{ steps.branch_decision.outputs.tier != 'gated' }}
|
|
599
|
+
uses: postman-cs/postman-repo-sync-action@v2.9.3
|
|
600
|
+
env:
|
|
601
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
602
|
+
POSTMAN_BRANCH_DECISION: ${{ steps.branch_decision.outputs.branch-decision }}
|
|
603
|
+
with:
|
|
604
|
+
project-name: ${{ inputs.project-name }}
|
|
605
|
+
repo-url: ${{ inputs.repo-url }}
|
|
606
|
+
workspace-id: ${{ steps.bootstrap.outputs.workspace-id }}
|
|
607
|
+
baseline-collection-id: ${{ steps.bootstrap.outputs.baseline-collection-id }}
|
|
608
|
+
smoke-collection-id: ${{ steps.bootstrap.outputs.smoke-collection-id }}
|
|
609
|
+
contract-collection-id: ${{ steps.bootstrap.outputs.contract-collection-id }}
|
|
610
|
+
onboarding-scope: ${{ inputs.onboarding-scope }}
|
|
611
|
+
# smoke_flow reshapes the cloud Smoke collection before repo-sync runs;
|
|
612
|
+
# digest-matched prebuilt reuse would keep the pre-reshape on-disk tree and
|
|
613
|
+
# skip the cloud export, so flow runs force a fresh export of every role.
|
|
614
|
+
prebuilt-collections-json: ${{ steps.smoke_flow.outcome == 'skipped' && steps.bootstrap.outputs.prebuilt-collections-json || '' }}
|
|
615
|
+
collection-sync-mode: ${{ inputs.collection-sync-mode }}
|
|
616
|
+
spec-sync-mode: ${{ inputs.spec-sync-mode }}
|
|
617
|
+
release-label: ${{ inputs.release-label }}
|
|
618
|
+
generate-ci-workflow: ${{ inputs.generate-ci-workflow }}
|
|
619
|
+
ci-workflow-path: ${{ inputs.ci-workflow-path }}
|
|
620
|
+
ci-runner-os: ${{ inputs.ci-runner-os }}
|
|
621
|
+
environments-json: ${{ inputs.environments-json }}
|
|
622
|
+
system-env-map-json: ${{ inputs.system-env-map-json }}
|
|
623
|
+
environment-uids-json: ${{ inputs.environment-uids-json }}
|
|
624
|
+
env-runtime-urls-json: ${{ inputs.env-runtime-urls-json }}
|
|
625
|
+
repo-write-mode: ${{ inputs.repo-write-mode }}
|
|
626
|
+
current-ref: ${{ inputs.current-ref }}
|
|
627
|
+
committer-name: ${{ inputs.committer-name }}
|
|
628
|
+
committer-email: ${{ inputs.committer-email }}
|
|
629
|
+
postman-api-key: ${{ inputs.postman-api-key }}
|
|
630
|
+
postman-access-token: ${{ inputs.postman-access-token }}
|
|
631
|
+
credential-preflight: ${{ inputs.credential-preflight }}
|
|
632
|
+
branch-strategy: ${{ inputs.branch-strategy }}
|
|
633
|
+
canonical-branch: ${{ inputs.canonical-branch }}
|
|
634
|
+
channels: ${{ inputs.channels }}
|
|
635
|
+
preview-ttl: ${{ inputs.preview-ttl }}
|
|
636
|
+
github-token: ${{ inputs.github-token }}
|
|
637
|
+
gh-fallback-token: ${{ inputs.gh-fallback-token }}
|
|
638
|
+
org-mode: ${{ inputs.org-mode }}
|
|
639
|
+
integration-backend: ${{ inputs.integration-backend }}
|
|
640
|
+
postman-region: ${{ inputs.postman-region }}
|
|
641
|
+
monitor-id: ${{ inputs.monitor-id }}
|
|
642
|
+
mock-url: ${{ inputs.mock-url }}
|
|
643
|
+
mock-visibility: ${{ inputs.mock-visibility }}
|
|
644
|
+
mock-environment-enabled: ${{ inputs.mock-environment-enabled }}
|
|
645
|
+
monitor-cron: ${{ inputs.monitor-cron }}
|
|
646
|
+
ssl-client-cert: ${{ inputs.ssl-client-cert }}
|
|
647
|
+
ssl-client-key: ${{ inputs.ssl-client-key }}
|
|
648
|
+
ssl-client-passphrase: ${{ inputs.ssl-client-passphrase }}
|
|
649
|
+
ssl-extra-ca-certs: ${{ inputs.ssl-extra-ca-certs }}
|
|
650
|
+
spec-id: ${{ steps.bootstrap.outputs.spec-id }}
|
|
651
|
+
spec-content-changed: ${{ steps.bootstrap.outputs.spec-content-changed }}
|
|
652
|
+
spec-path: ${{ inputs.spec-path }}
|
|
653
|
+
postman-stack: ${{ inputs.postman-stack }}
|
|
654
|
+
- id: warn_tests_skipped_no_api_key
|
|
655
|
+
name: Warn when built-in tests are skipped because no Postman API key is present
|
|
656
|
+
# D2: the built-in test step authenticates the Postman CLI with
|
|
657
|
+
# `postman login --with-api-key`, which has no access-token login path. When
|
|
658
|
+
# postman-api-key is absent (access-token-primary runs), skip the tests with
|
|
659
|
+
# a warning instead of failing the run.
|
|
660
|
+
if: ${{ inputs.onboarding-scope == 'full' && steps.bootstrap.outputs.collections-json != '' && inputs.skip-built-in-tests != 'true' && inputs.postman-api-key == '' }}
|
|
661
|
+
shell: bash
|
|
662
|
+
env:
|
|
663
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
664
|
+
run: |
|
|
665
|
+
echo "::warning::Skipping built-in smoke and contract tests: no postman-api-key was provided. The Postman CLI (postman login --with-api-key, then postman collection run) has no access-token login, so these tests require a PMAK. Provide postman-api-key to enable them, or set skip-built-in-tests: true to silence this warning."
|
|
666
|
+
- id: install_postman_cli_windows
|
|
667
|
+
name: Install Postman CLI on Windows
|
|
668
|
+
if: ${{ inputs.onboarding-scope == 'full' && runner.os == 'Windows' && steps.bootstrap.outputs.collections-json != '' && inputs.skip-built-in-tests != 'true' && inputs.postman-api-key != '' }}
|
|
669
|
+
shell: pwsh
|
|
670
|
+
env:
|
|
671
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
672
|
+
POSTMAN_CLI_INSTALL_URL: ${{ inputs.postman-stack == 'beta' && 'https://dl-cli.pstmn-beta.io/install/win64.ps1' || 'https://dl-cli.pstmn.io/install/win64.ps1' }}
|
|
673
|
+
run: |
|
|
674
|
+
$ErrorActionPreference = 'Stop'
|
|
675
|
+
if (-not (Get-Command postman -ErrorAction SilentlyContinue)) {
|
|
676
|
+
[System.Net.ServicePointManager]::SecurityProtocol = 3072
|
|
677
|
+
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString($env:POSTMAN_CLI_INSTALL_URL))
|
|
678
|
+
}
|
|
679
|
+
if (-not (Get-Command postman -ErrorAction SilentlyContinue)) {
|
|
680
|
+
throw 'Postman CLI installation completed but the postman command is unavailable.'
|
|
681
|
+
}
|
|
682
|
+
- id: run_tests_junit
|
|
683
|
+
name: Run smoke and contract collections with JUnit output
|
|
684
|
+
if: ${{ inputs.onboarding-scope == 'full' && steps.bootstrap.outputs.collections-json != '' && inputs.skip-built-in-tests != 'true' && inputs.postman-api-key != '' }}
|
|
685
|
+
shell: bash
|
|
686
|
+
continue-on-error: true
|
|
687
|
+
env:
|
|
688
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
689
|
+
POSTMAN_API_KEY: ${{ inputs.postman-api-key }}
|
|
690
|
+
POSTMAN_REGION: ${{ inputs.postman-region }}
|
|
691
|
+
PROJECT_NAME: ${{ inputs.project-name }}
|
|
692
|
+
COLLECTIONS_JSON: ${{ steps.bootstrap.outputs.collections-json }}
|
|
693
|
+
ENVIRONMENT_UIDS_JSON: ${{ steps.repo_sync.outputs.environment-uids-json }}
|
|
694
|
+
POSTMAN_CLI_INSTALL_URL: ${{ inputs.postman-stack == 'beta' && 'https://dl-cli.pstmn-beta.io/install/unix.sh' || 'https://dl-cli.pstmn.io/install/unix.sh' }}
|
|
695
|
+
run: |
|
|
696
|
+
set +e
|
|
697
|
+
mkdir -p "$RUNNER_TEMP/postman-junit"
|
|
698
|
+
|
|
699
|
+
escape_annotation() {
|
|
700
|
+
local value="$1"
|
|
701
|
+
value=${value//'%'/%25}
|
|
702
|
+
value=${value//$'\r'/%0D}
|
|
703
|
+
value=${value//$'\n'/%0A}
|
|
704
|
+
printf '%s' "$value"
|
|
705
|
+
}
|
|
706
|
+
PROJECT_ESCAPED=$(escape_annotation "${PROJECT_NAME:-}")
|
|
707
|
+
REGION_ESCAPED=$(escape_annotation "${POSTMAN_REGION:-}")
|
|
708
|
+
|
|
709
|
+
if ! command -v postman >/dev/null 2>&1; then
|
|
710
|
+
if [ "${RUNNER_OS:-}" = "Windows" ]; then
|
|
711
|
+
echo "::error::Postman CLI was not installed by the Windows setup step"
|
|
712
|
+
exit 1
|
|
713
|
+
fi
|
|
714
|
+
curl -fsSL "$POSTMAN_CLI_INSTALL_URL" | sh
|
|
715
|
+
export PATH="$HOME/.postman/cli:$PATH"
|
|
716
|
+
fi
|
|
717
|
+
|
|
718
|
+
if ! command -v jq >/dev/null 2>&1; then
|
|
719
|
+
echo "::error::jq is required to parse Postman collection and environment IDs"
|
|
720
|
+
exit 1
|
|
721
|
+
fi
|
|
722
|
+
|
|
723
|
+
if [ -n "$POSTMAN_API_KEY" ]; then
|
|
724
|
+
echo "::add-mask::$(escape_annotation "$POSTMAN_API_KEY")"
|
|
725
|
+
fi
|
|
726
|
+
|
|
727
|
+
if [ "$POSTMAN_REGION" = "eu" ]; then
|
|
728
|
+
postman login --with-api-key "$POSTMAN_API_KEY" --region eu >/dev/null
|
|
729
|
+
else
|
|
730
|
+
postman login --with-api-key "$POSTMAN_API_KEY" >/dev/null
|
|
731
|
+
fi
|
|
732
|
+
LOGIN_STATUS=$?
|
|
733
|
+
if [ "$LOGIN_STATUS" -ne 0 ]; then
|
|
734
|
+
echo "::warning::Postman CLI login failed for project=${PROJECT_ESCAPED} region=${REGION_ESCAPED}: exit status ${LOGIN_STATUS} (see preceding CLI stderr for cause). Verify postman-api-key and postman-region, then rerun."
|
|
735
|
+
fi
|
|
736
|
+
|
|
737
|
+
SMOKE=$(printf '%s' "$COLLECTIONS_JSON" | jq -r '.smoke // empty')
|
|
738
|
+
SMOKE_JQ_STATUS=$?
|
|
739
|
+
CONTRACT=$(printf '%s' "$COLLECTIONS_JSON" | jq -r '.contract // empty')
|
|
740
|
+
CONTRACT_JQ_STATUS=$?
|
|
741
|
+
if [ "$SMOKE_JQ_STATUS" -ne 0 ]; then
|
|
742
|
+
echo "::warning::Failed to parse collections-json for project=${PROJECT_ESCAPED}: exit status ${SMOKE_JQ_STATUS} (see preceding jq stderr for cause). Inspect the collections-json upstream step output and rerun."
|
|
743
|
+
elif [ "$CONTRACT_JQ_STATUS" -ne 0 ]; then
|
|
744
|
+
echo "::warning::Failed to parse collections-json for project=${PROJECT_ESCAPED}: exit status ${CONTRACT_JQ_STATUS} (see preceding jq stderr for cause). Inspect the collections-json upstream step output and rerun."
|
|
745
|
+
fi
|
|
746
|
+
ENV_UID=$(printf '%s' "$ENVIRONMENT_UIDS_JSON" | jq -r 'to_entries | (.[0].value // empty)')
|
|
747
|
+
ENV_JQ_STATUS=$?
|
|
748
|
+
if [ "$ENV_JQ_STATUS" -ne 0 ]; then
|
|
749
|
+
echo "::warning::Failed to parse environment-uids-json for project=${PROJECT_ESCAPED}: exit status ${ENV_JQ_STATUS} (see preceding jq stderr for cause). Inspect the environment-uids-json upstream step output and rerun."
|
|
750
|
+
fi
|
|
751
|
+
|
|
752
|
+
ENV_FLAG=()
|
|
753
|
+
if [ -n "$ENV_UID" ]; then
|
|
754
|
+
ENV_FLAG=(-e "$ENV_UID")
|
|
755
|
+
fi
|
|
756
|
+
if [ -n "$ENV_UID" ]; then
|
|
757
|
+
ENV_LABEL=$(escape_annotation "$ENV_UID")
|
|
758
|
+
else
|
|
759
|
+
ENV_LABEL=none
|
|
760
|
+
fi
|
|
761
|
+
|
|
762
|
+
if [ -n "$SMOKE" ]; then
|
|
763
|
+
postman collection run "$SMOKE" "${ENV_FLAG[@]}" \
|
|
764
|
+
--reporters cli,junit \
|
|
765
|
+
--reporter-junit-export "$RUNNER_TEMP/postman-junit/smoke.xml"
|
|
766
|
+
SMOKE_RUN_STATUS=$?
|
|
767
|
+
if [ "$SMOKE_RUN_STATUS" -ne 0 ]; then
|
|
768
|
+
SMOKE_ESCAPED=$(escape_annotation "$SMOKE")
|
|
769
|
+
echo "::warning::Smoke collection run failed for collection=${SMOKE_ESCAPED} project=${PROJECT_ESCAPED} environment=${ENV_LABEL}: exit status ${SMOKE_RUN_STATUS} (see preceding CLI output for cause). Fix auth, environment, or request failures, then rerun."
|
|
770
|
+
fi
|
|
771
|
+
fi
|
|
772
|
+
|
|
773
|
+
if [ -n "$CONTRACT" ]; then
|
|
774
|
+
postman collection run "$CONTRACT" "${ENV_FLAG[@]}" \
|
|
775
|
+
--reporters cli,junit \
|
|
776
|
+
--reporter-junit-export "$RUNNER_TEMP/postman-junit/contract.xml"
|
|
777
|
+
CONTRACT_RUN_STATUS=$?
|
|
778
|
+
if [ "$CONTRACT_RUN_STATUS" -ne 0 ]; then
|
|
779
|
+
CONTRACT_ESCAPED=$(escape_annotation "$CONTRACT")
|
|
780
|
+
echo "::warning::Contract collection run failed for collection=${CONTRACT_ESCAPED} project=${PROJECT_ESCAPED} environment=${ENV_LABEL}: exit status ${CONTRACT_RUN_STATUS} (see preceding CLI output for cause). Fix auth, environment, or request failures, then rerun."
|
|
781
|
+
fi
|
|
782
|
+
fi
|
|
783
|
+
- id: upload_junit_artifact
|
|
784
|
+
name: Upload Postman JUnit results
|
|
785
|
+
if: always() && inputs.onboarding-scope == 'full' && inputs.skip-built-in-tests != 'true'
|
|
786
|
+
env:
|
|
787
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
788
|
+
uses: actions/upload-artifact@v7.0.1
|
|
789
|
+
with:
|
|
790
|
+
name: postman-test-results
|
|
791
|
+
path: ${{ runner.temp }}/postman-junit/*.xml
|
|
792
|
+
if-no-files-found: ignore
|
|
793
|
+
- id: insights_onboarding
|
|
794
|
+
if: inputs.onboarding-scope == 'full' && inputs.enable-insights == 'true' && steps.branch_decision.outputs.tier != 'gated'
|
|
795
|
+
name: Onboard Postman Insights
|
|
796
|
+
uses: postman-cs/postman-insights-onboarding-action@v2.4.4
|
|
797
|
+
env:
|
|
798
|
+
POSTMAN_TEAM_ID: ${{ inputs.postman-team-id }}
|
|
799
|
+
POSTMAN_BRANCH_DECISION: ${{ steps.branch_decision.outputs.branch-decision }}
|
|
800
|
+
with:
|
|
801
|
+
project-name: ${{ inputs.project-name }}
|
|
802
|
+
workspace-id: ${{ steps.bootstrap.outputs.workspace-id }}
|
|
803
|
+
environment-id: ${{ fromJSON(steps.repo_sync.outputs.environment-uids-json)[fromJSON(inputs.environments-json)[0]] }}
|
|
804
|
+
system-environment-id: ${{ fromJSON(inputs.system-env-map-json)[fromJSON(inputs.environments-json)[0]] }}
|
|
805
|
+
cluster-name: ${{ inputs.cluster-name }}
|
|
806
|
+
postman-api-key: ${{ inputs.insights-postman-api-key }}
|
|
807
|
+
postman-access-token: ${{ inputs.insights-postman-access-token }}
|
|
808
|
+
credential-preflight: ${{ inputs.credential-preflight }}
|
|
809
|
+
branch-strategy: ${{ inputs.branch-strategy }}
|
|
810
|
+
canonical-branch: ${{ inputs.canonical-branch }}
|
|
811
|
+
channels: ${{ inputs.channels }}
|
|
812
|
+
postman-team-id: ${{ inputs.postman-team-id }}
|
|
813
|
+
github-token: ${{ inputs.github-token }}
|
|
814
|
+
postman-region: ${{ inputs.postman-region }}
|
|
815
|
+
postman-stack: ${{ inputs.postman-stack }}
|