@postman-cse/onboarding-repo-sync 0.10.1 → 0.12.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 CHANGED
@@ -9,7 +9,7 @@ Retained from finalize:
9
9
  - Create or update Postman environments from runtime URLs.
10
10
  - Associate Postman environments to system environments through Bifrost.
11
11
  - Create mock servers and smoke monitors from generated collections.
12
- - Export Postman collections in the Collection v3 multi-file YAML directory structure under `postman/collections/` (e.g., `[Baseline] <name>/collection.yaml`, nested folder and request YAML files). Persist repo variables and export environments into the repository under `postman/` and `.postman/`.
12
+ - Export Postman collections in the Collection v3 multi-file YAML directory structure under `postman/collections/` (e.g., `[Baseline] <name>/collection.yaml`, nested folder and request YAML files), and export environments plus `.postman/resources.yaml` into the repository.
13
13
  - Link the Postman workspace to the repository (GitHub or GitLab) through Bifrost.
14
14
  - Commit synced artifacts and push them back to the current checked out ref.
15
15
 
@@ -205,6 +205,41 @@ If the action writes `.github/workflows/ci.yml`, provide a credential source tha
205
205
 
206
206
  Collections are exported in the Postman Collection v3 format, producing a multi-file YAML directory structure under `postman/collections/`. Each collection (Baseline, Smoke, Contract) gets its own directory containing `collection.yaml` and nested folder/request YAML files. The `.postman/resources.yaml` manifest maps each v3 collection directory to its Postman UID.
207
207
 
208
+ The generated CI workflow reads `.postman/resources.yaml` directly to resolve the smoke/contract collection IDs and environment ID for Postman CLI runs. It does not depend on repository variables for those asset mappings.
209
+
210
+ To match the app scaffold more closely, repo-sync also ensures these directories exist under `postman/`:
211
+
212
+ - `collections`
213
+ - `environments`
214
+ - `flows`
215
+ - `globals`
216
+ - `mocks`
217
+ - `specs`
218
+
219
+ It also writes `postman/globals/workspace.globals.yaml` when missing.
220
+
221
+ Folder and request **names are truncated to 120 characters** per path segment when writing files (with an ellipsis). That avoids `ENAMETOOLONG` when Postman item names are very long (for example, copied from long OpenAPI operation summaries).
222
+
223
+ ### Local spec metadata
224
+
225
+ Repo-sync now scans the repository for local OpenAPI files and records them in `.postman/resources.yaml` under `localResources.specs`.
226
+
227
+ - If `spec-path` is provided, it is used as the preferred local spec for `cloudResources.specs` and `.postman/workflows.yaml`.
228
+ - If `spec-path` is omitted and exactly one local OpenAPI file is found, that file is used automatically.
229
+ - If the local spec target is ambiguous or missing, repo-sync skips the spec cloud map and `workflows.yaml` rather than emitting incorrect relationships.
230
+
231
+ When a local spec file and exported collections are both available, repo-sync writes `.postman/workflows.yaml` with `syncSpecToCollection` entries so the spec↔collection relationship metadata matches the app more closely.
232
+
233
+ ### Lifecycle and versioning
234
+
235
+ `collection-sync-mode` controls collection lifecycle behavior:
236
+
237
+ - `refresh` (default): always refresh assets and rewrite `.postman/resources.yaml` for the checked-out ref.
238
+ - `reuse`: reuse existing assets from explicit inputs or the checked-out ref's `.postman/resources.yaml`.
239
+ - `version`: require a release label (`release-label` input or `github-ref-name`), suffix collection export directories and mock/monitor names with that release label, and reuse only the checked-out ref's `.postman/resources.yaml` mappings.
240
+
241
+ `spec-sync-mode` supports `update` (default) and `version`. If either sync mode is `version`, this action requires a derived or explicit release label.
242
+
208
243
  ## Inputs
209
244
 
210
245
  | Input | Default | Notes |
@@ -214,16 +249,20 @@ Collections are exported in the Postman Collection v3 format, producing a multi-
214
249
  | `project-name` | | Service name used for environments, mock servers, and monitors. |
215
250
  | `workspace-id` | | Workspace identifier used for workspace-link and export metadata. |
216
251
  | `baseline-collection-id` | | Baseline collection exported into the repo and used for mock generation. |
217
- | `monitor-type` | `cloud` | Type of monitor to create (`cloud` or `cli`). `cli` uses GitHub Actions cron.
252
+ | `monitor-type` | `cloud` | Type of monitor to create (`cloud` or `cli`). `cli` uses GitHub Actions cron. |
218
253
  | `smoke-collection-id` | | Smoke collection used for monitor creation. |
219
254
  | `contract-collection-id` | | Contract collection exported into the repo. |
255
+ | `collection-sync-mode` | `refresh` | Collection lifecycle mode: `refresh`, `reuse`, or `version`. |
256
+ | `spec-sync-mode` | `update` | Spec lifecycle mode: `update` or `version`. |
257
+ | `release-label` | | Optional release label for versioned naming. Falls back to `github-ref-name` when omitted. |
258
+ | `spec-path` | | Optional repo-root-relative path to the local spec file for `resources.yaml` and `workflows.yaml` metadata. |
220
259
  | `environments-json` | `["prod"]` | Environment slugs to create or update. |
221
260
  | `repo-url` | | Explicit repository URL (GitHub or GitLab). Defaults to `https://github.com/$GITHUB_REPOSITORY` on GitHub Actions, or `$CI_PROJECT_URL` on GitLab CI. |
222
261
  | `integration-backend` | `bifrost` | Public open-alpha starts with Bifrost only. |
223
262
  | `workspace-link-enabled` | `true` | Keeps workspace linking in scope. |
224
263
  | `environment-sync-enabled` | `true` | Keeps environment association in scope by default for the open-alpha demonstration path. |
225
264
  | `system-env-map-json` | `{}` | JSON map of environment slug to system environment id. |
226
- | `environment-uids-json` | `{}` | JSON map of environment slug to Postman environment uid. |
265
+ | `environment-uids-json` | `{}` | Optional explicit JSON map of environment slug to Postman environment uid. |
227
266
  | `env-runtime-urls-json` | `{}` | JSON map of environment slug to runtime base URL. |
228
267
  | `artifact-dir` | `postman` | Root directory for exported Postman artifacts. |
229
268
  | `repo-write-mode` | `commit-and-push` | Generates files and pushes with current-ref semantics. |
@@ -236,11 +275,22 @@ Collections are exported in the Postman Collection v3 format, producing a multi-
236
275
  | `ssl-client-key` | | Base64-encoded private key paired with `ssl-client-cert`. |
237
276
  | `ssl-client-passphrase` | | Optional passphrase for the client key. |
238
277
  | `ssl-extra-ca-certs` | | Base64-encoded extra CA certificates used to trust private certificate chains. |
239
- | `github-token` | | GitHub token for repo variables and commits. |
278
+ | `github-token` | | GitHub token for commits, workflow updates, and optional secret persistence. |
240
279
  | `gh-fallback-token` | | Fallback GitHub token for workflow-file and variable APIs. |
241
- | `github-auth-mode` | `github_token_first` | GitHub auth mode for repo variable APIs. |
242
280
  | `ci-workflow-base64` | | Optional base64-encoded workflow content that overrides the built-in CI template. |
243
281
 
282
+ ### Contract smoke monitoring
283
+
284
+ This repo includes `.github/workflows/contract-smoke.yml`, a scheduled live contract check for the Postman and Bifrost endpoints used by repo-sync.
285
+
286
+ Configure these repository secrets before enabling the workflow:
287
+
288
+ - `SMOKE_ORG_API_KEY`
289
+ - `SMOKE_ORG_ACCESS_TOKEN`
290
+ - `SMOKE_NON_ORG_API_KEY`
291
+
292
+ The smoke workflow verifies `/me`, `/teams`, and Bifrost API key creation so upstream auth or response-shape changes are caught before they break repo-sync runs.
293
+
244
294
  ### Obtaining `postman-api-key`
245
295
 
246
296
  The `postman-api-key` is a Postman API key (PMAK) used for all standard Postman API operations — creating workspaces, uploading specs, generating collections, exporting artifacts, and managing environments.
package/action.yml CHANGED
@@ -29,6 +29,17 @@ inputs:
29
29
  contract-collection-id:
30
30
  description: Contract collection ID used for exported artifacts.
31
31
  required: false
32
+ collection-sync-mode:
33
+ description: Collection sync lifecycle mode (refresh, reuse, or version).
34
+ required: false
35
+ default: refresh
36
+ spec-sync-mode:
37
+ description: Spec sync lifecycle mode (update or version).
38
+ required: false
39
+ default: update
40
+ release-label:
41
+ description: Optional release label used for versioned naming.
42
+ required: false
32
43
  monitor-id:
33
44
  description: Existing smoke monitor ID. When set, the action validates and reuses this monitor instead of creating a new one.
34
45
  required: false
@@ -101,10 +112,6 @@ inputs:
101
112
  gh-fallback-token:
102
113
  description: Fallback token for repository variable APIs and workflow-file pushes.
103
114
  required: false
104
- github-auth-mode:
105
- description: GitHub auth mode for repository variable APIs.
106
- required: false
107
- default: github_token_first
108
115
  org-mode:
109
116
  description: Whether the Postman team uses org-mode. When true, x-entity-team-id header is included in Bifrost proxy calls. Non-org teams must omit this header.
110
117
  required: false
@@ -124,6 +131,12 @@ inputs:
124
131
  ssl-extra-ca-certs:
125
132
  description: Optional base64-encoded PEM CA certificate bundle for custom trust.
126
133
  required: false
134
+ spec-id:
135
+ description: Spec UID from bootstrap, persisted into .postman/resources.yaml cloudResources.
136
+ required: false
137
+ spec-path:
138
+ description: Optional repo-root-relative path to the local spec file for resources/workflows metadata.
139
+ required: false
127
140
  outputs:
128
141
  integration-backend:
129
142
  description: Resolved integration backend for the open-alpha run.