@postman-cse/onboarding-repo-sync 2.7.1 → 2.7.3
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/dist/action.cjs +35 -16
- package/dist/cli.cjs +35 -16
- package/dist/index.cjs +35 -16
- package/package.json +4 -3
package/dist/action.cjs
CHANGED
|
@@ -118357,8 +118357,11 @@ var PostmanGatewayAssetsClient = class {
|
|
|
118357
118357
|
path: `/jobTemplates/${uid}?_etc=true`
|
|
118358
118358
|
});
|
|
118359
118359
|
return true;
|
|
118360
|
-
} catch {
|
|
118361
|
-
|
|
118360
|
+
} catch (error2) {
|
|
118361
|
+
if (error2 instanceof HttpError && error2.status === 404) {
|
|
118362
|
+
return false;
|
|
118363
|
+
}
|
|
118364
|
+
throw error2;
|
|
118362
118365
|
}
|
|
118363
118366
|
}
|
|
118364
118367
|
async findMonitorByCollection(collectionUid, environmentUid, name) {
|
|
@@ -118366,6 +118369,22 @@ var PostmanGatewayAssetsClient = class {
|
|
|
118366
118369
|
const environment = String(environmentUid ?? "").trim();
|
|
118367
118370
|
const monitorName = String(name ?? "").trim();
|
|
118368
118371
|
const monitors = await this.listMonitors();
|
|
118372
|
+
const sameNameMatches = monitors.filter((monitor) => monitor.name === monitorName);
|
|
118373
|
+
const sameNameEnvironmentMatches = sameNameMatches.filter((monitor) => monitor.environmentUid === environment);
|
|
118374
|
+
try {
|
|
118375
|
+
this.selectExactMatch(
|
|
118376
|
+
"monitor",
|
|
118377
|
+
`workspace ${this.workspaceId}, name "${monitorName}", and environment ${environment || "(none)"}`,
|
|
118378
|
+
sameNameEnvironmentMatches
|
|
118379
|
+
);
|
|
118380
|
+
} catch (error2) {
|
|
118381
|
+
const environments = [...new Set(sameNameMatches.map((monitor) => monitor.environmentUid || "(none)"))];
|
|
118382
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
118383
|
+
throw new Error(
|
|
118384
|
+
`${message} Same-name monitor(s) also exist on environment(s): ${environments.join(", ")}.`,
|
|
118385
|
+
{ cause: error2 }
|
|
118386
|
+
);
|
|
118387
|
+
}
|
|
118369
118388
|
const matches = monitors.filter(
|
|
118370
118389
|
(monitor) => monitor.collectionUid === want && monitor.environmentUid === environment && monitor.name === monitorName
|
|
118371
118390
|
);
|
|
@@ -118857,9 +118876,9 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
118857
118876
|
headBranch = headRef;
|
|
118858
118877
|
rawRef = clean(env.GITHUB_REF) ?? headRef;
|
|
118859
118878
|
refKind = "branch";
|
|
118860
|
-
const headRepo = event?.pull_request?.head?.repo?.full_name;
|
|
118861
|
-
const baseRepo = event?.pull_request?.base?.repo?.full_name
|
|
118862
|
-
isForkPr =
|
|
118879
|
+
const headRepo = clean(event?.pull_request?.head?.repo?.full_name)?.toLowerCase();
|
|
118880
|
+
const baseRepo = clean(event?.pull_request?.base?.repo?.full_name)?.toLowerCase();
|
|
118881
|
+
isForkPr = !(headRepo && baseRepo && headRepo === baseRepo);
|
|
118863
118882
|
headSha = clean(event?.pull_request?.head?.sha) ?? headSha;
|
|
118864
118883
|
} else {
|
|
118865
118884
|
rawRef = clean(env.GITHUB_REF) ?? clean(env.GITHUB_REF_NAME);
|
|
@@ -118880,7 +118899,7 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
118880
118899
|
refKind = "branch";
|
|
118881
118900
|
const sourceProject = clean(env.CI_MERGE_REQUEST_SOURCE_PROJECT_ID);
|
|
118882
118901
|
const targetProject = clean(env.CI_MERGE_REQUEST_PROJECT_ID);
|
|
118883
|
-
isForkPr =
|
|
118902
|
+
isForkPr = !(sourceProject && targetProject && sourceProject === targetProject);
|
|
118884
118903
|
} else if (clean(env.CI_COMMIT_TAG)) {
|
|
118885
118904
|
rawRef = clean(env.CI_COMMIT_TAG);
|
|
118886
118905
|
refKind = "tag";
|
|
@@ -118914,7 +118933,7 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
118914
118933
|
rawRef = prSource;
|
|
118915
118934
|
refKind = parsed.kind;
|
|
118916
118935
|
const forkFlag = clean(env.SYSTEM_PULLREQUEST_ISFORK);
|
|
118917
|
-
isForkPr = forkFlag?.toLowerCase()
|
|
118936
|
+
isForkPr = forkFlag?.toLowerCase() !== "false";
|
|
118918
118937
|
} else {
|
|
118919
118938
|
rawRef = clean(env.BUILD_SOURCEBRANCH);
|
|
118920
118939
|
const parsed = stripRefPrefix(rawRef);
|
|
@@ -118999,6 +119018,15 @@ function resolveBranchDecision(options) {
|
|
|
118999
119018
|
reason: `ref kind ${identity.refKind}: never canonical/preview-eligible; no-op with annotation`
|
|
119000
119019
|
};
|
|
119001
119020
|
}
|
|
119021
|
+
if (identity.isForkPr) {
|
|
119022
|
+
return {
|
|
119023
|
+
tier: "gated",
|
|
119024
|
+
strategy,
|
|
119025
|
+
identity,
|
|
119026
|
+
canonicalBranch,
|
|
119027
|
+
reason: "fork PR: never write-eligible (canonical/channel/preview require a same-repo head), gated instead"
|
|
119028
|
+
};
|
|
119029
|
+
}
|
|
119002
119030
|
if (identity.headBranch === canonicalBranch) {
|
|
119003
119031
|
return {
|
|
119004
119032
|
tier: "canonical",
|
|
@@ -119020,15 +119048,6 @@ function resolveBranchDecision(options) {
|
|
|
119020
119048
|
};
|
|
119021
119049
|
}
|
|
119022
119050
|
if (strategy === "preview") {
|
|
119023
|
-
if (identity.isForkPr) {
|
|
119024
|
-
return {
|
|
119025
|
-
tier: "gated",
|
|
119026
|
-
strategy,
|
|
119027
|
-
identity,
|
|
119028
|
-
canonicalBranch,
|
|
119029
|
-
reason: "fork PR: preview-ineligible (same-repo gate), gated instead"
|
|
119030
|
-
};
|
|
119031
|
-
}
|
|
119032
119051
|
return {
|
|
119033
119052
|
tier: "preview",
|
|
119034
119053
|
strategy,
|
package/dist/cli.cjs
CHANGED
|
@@ -116462,8 +116462,11 @@ var PostmanGatewayAssetsClient = class {
|
|
|
116462
116462
|
path: `/jobTemplates/${uid}?_etc=true`
|
|
116463
116463
|
});
|
|
116464
116464
|
return true;
|
|
116465
|
-
} catch {
|
|
116466
|
-
|
|
116465
|
+
} catch (error) {
|
|
116466
|
+
if (error instanceof HttpError && error.status === 404) {
|
|
116467
|
+
return false;
|
|
116468
|
+
}
|
|
116469
|
+
throw error;
|
|
116467
116470
|
}
|
|
116468
116471
|
}
|
|
116469
116472
|
async findMonitorByCollection(collectionUid, environmentUid, name) {
|
|
@@ -116471,6 +116474,22 @@ var PostmanGatewayAssetsClient = class {
|
|
|
116471
116474
|
const environment = String(environmentUid ?? "").trim();
|
|
116472
116475
|
const monitorName = String(name ?? "").trim();
|
|
116473
116476
|
const monitors = await this.listMonitors();
|
|
116477
|
+
const sameNameMatches = monitors.filter((monitor) => monitor.name === monitorName);
|
|
116478
|
+
const sameNameEnvironmentMatches = sameNameMatches.filter((monitor) => monitor.environmentUid === environment);
|
|
116479
|
+
try {
|
|
116480
|
+
this.selectExactMatch(
|
|
116481
|
+
"monitor",
|
|
116482
|
+
`workspace ${this.workspaceId}, name "${monitorName}", and environment ${environment || "(none)"}`,
|
|
116483
|
+
sameNameEnvironmentMatches
|
|
116484
|
+
);
|
|
116485
|
+
} catch (error) {
|
|
116486
|
+
const environments = [...new Set(sameNameMatches.map((monitor) => monitor.environmentUid || "(none)"))];
|
|
116487
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
116488
|
+
throw new Error(
|
|
116489
|
+
`${message} Same-name monitor(s) also exist on environment(s): ${environments.join(", ")}.`,
|
|
116490
|
+
{ cause: error }
|
|
116491
|
+
);
|
|
116492
|
+
}
|
|
116474
116493
|
const matches = monitors.filter(
|
|
116475
116494
|
(monitor) => monitor.collectionUid === want && monitor.environmentUid === environment && monitor.name === monitorName
|
|
116476
116495
|
);
|
|
@@ -116910,9 +116929,9 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
116910
116929
|
headBranch = headRef;
|
|
116911
116930
|
rawRef = clean(env.GITHUB_REF) ?? headRef;
|
|
116912
116931
|
refKind = "branch";
|
|
116913
|
-
const headRepo = event?.pull_request?.head?.repo?.full_name;
|
|
116914
|
-
const baseRepo = event?.pull_request?.base?.repo?.full_name
|
|
116915
|
-
isForkPr =
|
|
116932
|
+
const headRepo = clean(event?.pull_request?.head?.repo?.full_name)?.toLowerCase();
|
|
116933
|
+
const baseRepo = clean(event?.pull_request?.base?.repo?.full_name)?.toLowerCase();
|
|
116934
|
+
isForkPr = !(headRepo && baseRepo && headRepo === baseRepo);
|
|
116916
116935
|
headSha = clean(event?.pull_request?.head?.sha) ?? headSha;
|
|
116917
116936
|
} else {
|
|
116918
116937
|
rawRef = clean(env.GITHUB_REF) ?? clean(env.GITHUB_REF_NAME);
|
|
@@ -116933,7 +116952,7 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
116933
116952
|
refKind = "branch";
|
|
116934
116953
|
const sourceProject = clean(env.CI_MERGE_REQUEST_SOURCE_PROJECT_ID);
|
|
116935
116954
|
const targetProject = clean(env.CI_MERGE_REQUEST_PROJECT_ID);
|
|
116936
|
-
isForkPr =
|
|
116955
|
+
isForkPr = !(sourceProject && targetProject && sourceProject === targetProject);
|
|
116937
116956
|
} else if (clean(env.CI_COMMIT_TAG)) {
|
|
116938
116957
|
rawRef = clean(env.CI_COMMIT_TAG);
|
|
116939
116958
|
refKind = "tag";
|
|
@@ -116967,7 +116986,7 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
116967
116986
|
rawRef = prSource;
|
|
116968
116987
|
refKind = parsed.kind;
|
|
116969
116988
|
const forkFlag = clean(env.SYSTEM_PULLREQUEST_ISFORK);
|
|
116970
|
-
isForkPr = forkFlag?.toLowerCase()
|
|
116989
|
+
isForkPr = forkFlag?.toLowerCase() !== "false";
|
|
116971
116990
|
} else {
|
|
116972
116991
|
rawRef = clean(env.BUILD_SOURCEBRANCH);
|
|
116973
116992
|
const parsed = stripRefPrefix(rawRef);
|
|
@@ -117052,6 +117071,15 @@ function resolveBranchDecision(options) {
|
|
|
117052
117071
|
reason: `ref kind ${identity.refKind}: never canonical/preview-eligible; no-op with annotation`
|
|
117053
117072
|
};
|
|
117054
117073
|
}
|
|
117074
|
+
if (identity.isForkPr) {
|
|
117075
|
+
return {
|
|
117076
|
+
tier: "gated",
|
|
117077
|
+
strategy,
|
|
117078
|
+
identity,
|
|
117079
|
+
canonicalBranch,
|
|
117080
|
+
reason: "fork PR: never write-eligible (canonical/channel/preview require a same-repo head), gated instead"
|
|
117081
|
+
};
|
|
117082
|
+
}
|
|
117055
117083
|
if (identity.headBranch === canonicalBranch) {
|
|
117056
117084
|
return {
|
|
117057
117085
|
tier: "canonical",
|
|
@@ -117073,15 +117101,6 @@ function resolveBranchDecision(options) {
|
|
|
117073
117101
|
};
|
|
117074
117102
|
}
|
|
117075
117103
|
if (strategy === "preview") {
|
|
117076
|
-
if (identity.isForkPr) {
|
|
117077
|
-
return {
|
|
117078
|
-
tier: "gated",
|
|
117079
|
-
strategy,
|
|
117080
|
-
identity,
|
|
117081
|
-
canonicalBranch,
|
|
117082
|
-
reason: "fork PR: preview-ineligible (same-repo gate), gated instead"
|
|
117083
|
-
};
|
|
117084
|
-
}
|
|
117085
117104
|
return {
|
|
117086
117105
|
tier: "preview",
|
|
117087
117106
|
strategy,
|
package/dist/index.cjs
CHANGED
|
@@ -118381,8 +118381,11 @@ var PostmanGatewayAssetsClient = class {
|
|
|
118381
118381
|
path: `/jobTemplates/${uid}?_etc=true`
|
|
118382
118382
|
});
|
|
118383
118383
|
return true;
|
|
118384
|
-
} catch {
|
|
118385
|
-
|
|
118384
|
+
} catch (error2) {
|
|
118385
|
+
if (error2 instanceof HttpError && error2.status === 404) {
|
|
118386
|
+
return false;
|
|
118387
|
+
}
|
|
118388
|
+
throw error2;
|
|
118386
118389
|
}
|
|
118387
118390
|
}
|
|
118388
118391
|
async findMonitorByCollection(collectionUid, environmentUid, name) {
|
|
@@ -118390,6 +118393,22 @@ var PostmanGatewayAssetsClient = class {
|
|
|
118390
118393
|
const environment = String(environmentUid ?? "").trim();
|
|
118391
118394
|
const monitorName = String(name ?? "").trim();
|
|
118392
118395
|
const monitors = await this.listMonitors();
|
|
118396
|
+
const sameNameMatches = monitors.filter((monitor) => monitor.name === monitorName);
|
|
118397
|
+
const sameNameEnvironmentMatches = sameNameMatches.filter((monitor) => monitor.environmentUid === environment);
|
|
118398
|
+
try {
|
|
118399
|
+
this.selectExactMatch(
|
|
118400
|
+
"monitor",
|
|
118401
|
+
`workspace ${this.workspaceId}, name "${monitorName}", and environment ${environment || "(none)"}`,
|
|
118402
|
+
sameNameEnvironmentMatches
|
|
118403
|
+
);
|
|
118404
|
+
} catch (error2) {
|
|
118405
|
+
const environments = [...new Set(sameNameMatches.map((monitor) => monitor.environmentUid || "(none)"))];
|
|
118406
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
118407
|
+
throw new Error(
|
|
118408
|
+
`${message} Same-name monitor(s) also exist on environment(s): ${environments.join(", ")}.`,
|
|
118409
|
+
{ cause: error2 }
|
|
118410
|
+
);
|
|
118411
|
+
}
|
|
118393
118412
|
const matches = monitors.filter(
|
|
118394
118413
|
(monitor) => monitor.collectionUid === want && monitor.environmentUid === environment && monitor.name === monitorName
|
|
118395
118414
|
);
|
|
@@ -118881,9 +118900,9 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
118881
118900
|
headBranch = headRef;
|
|
118882
118901
|
rawRef = clean(env.GITHUB_REF) ?? headRef;
|
|
118883
118902
|
refKind = "branch";
|
|
118884
|
-
const headRepo = event?.pull_request?.head?.repo?.full_name;
|
|
118885
|
-
const baseRepo = event?.pull_request?.base?.repo?.full_name
|
|
118886
|
-
isForkPr =
|
|
118903
|
+
const headRepo = clean(event?.pull_request?.head?.repo?.full_name)?.toLowerCase();
|
|
118904
|
+
const baseRepo = clean(event?.pull_request?.base?.repo?.full_name)?.toLowerCase();
|
|
118905
|
+
isForkPr = !(headRepo && baseRepo && headRepo === baseRepo);
|
|
118887
118906
|
headSha = clean(event?.pull_request?.head?.sha) ?? headSha;
|
|
118888
118907
|
} else {
|
|
118889
118908
|
rawRef = clean(env.GITHUB_REF) ?? clean(env.GITHUB_REF_NAME);
|
|
@@ -118904,7 +118923,7 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
118904
118923
|
refKind = "branch";
|
|
118905
118924
|
const sourceProject = clean(env.CI_MERGE_REQUEST_SOURCE_PROJECT_ID);
|
|
118906
118925
|
const targetProject = clean(env.CI_MERGE_REQUEST_PROJECT_ID);
|
|
118907
|
-
isForkPr =
|
|
118926
|
+
isForkPr = !(sourceProject && targetProject && sourceProject === targetProject);
|
|
118908
118927
|
} else if (clean(env.CI_COMMIT_TAG)) {
|
|
118909
118928
|
rawRef = clean(env.CI_COMMIT_TAG);
|
|
118910
118929
|
refKind = "tag";
|
|
@@ -118938,7 +118957,7 @@ function resolveBranchIdentity(env = process.env, overrides = {}) {
|
|
|
118938
118957
|
rawRef = prSource;
|
|
118939
118958
|
refKind = parsed.kind;
|
|
118940
118959
|
const forkFlag = clean(env.SYSTEM_PULLREQUEST_ISFORK);
|
|
118941
|
-
isForkPr = forkFlag?.toLowerCase()
|
|
118960
|
+
isForkPr = forkFlag?.toLowerCase() !== "false";
|
|
118942
118961
|
} else {
|
|
118943
118962
|
rawRef = clean(env.BUILD_SOURCEBRANCH);
|
|
118944
118963
|
const parsed = stripRefPrefix(rawRef);
|
|
@@ -119023,6 +119042,15 @@ function resolveBranchDecision(options) {
|
|
|
119023
119042
|
reason: `ref kind ${identity.refKind}: never canonical/preview-eligible; no-op with annotation`
|
|
119024
119043
|
};
|
|
119025
119044
|
}
|
|
119045
|
+
if (identity.isForkPr) {
|
|
119046
|
+
return {
|
|
119047
|
+
tier: "gated",
|
|
119048
|
+
strategy,
|
|
119049
|
+
identity,
|
|
119050
|
+
canonicalBranch,
|
|
119051
|
+
reason: "fork PR: never write-eligible (canonical/channel/preview require a same-repo head), gated instead"
|
|
119052
|
+
};
|
|
119053
|
+
}
|
|
119026
119054
|
if (identity.headBranch === canonicalBranch) {
|
|
119027
119055
|
return {
|
|
119028
119056
|
tier: "canonical",
|
|
@@ -119044,15 +119072,6 @@ function resolveBranchDecision(options) {
|
|
|
119044
119072
|
};
|
|
119045
119073
|
}
|
|
119046
119074
|
if (strategy === "preview") {
|
|
119047
|
-
if (identity.isForkPr) {
|
|
119048
|
-
return {
|
|
119049
|
-
tier: "gated",
|
|
119050
|
-
strategy,
|
|
119051
|
-
identity,
|
|
119052
|
-
canonicalBranch,
|
|
119053
|
-
reason: "fork PR: preview-ineligible (same-repo gate), gated instead"
|
|
119054
|
-
};
|
|
119055
|
-
}
|
|
119056
119075
|
return {
|
|
119057
119076
|
tier: "preview",
|
|
119058
119077
|
strategy,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postman-cse/onboarding-repo-sync",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"description": "Postman repo sync GitHub Action.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"lint": "eslint .",
|
|
27
27
|
"lint:fix": "eslint . --fix",
|
|
28
28
|
"test": "vitest run --exclude tests/ci-workflow-template.test.ts && vitest run tests/ci-workflow-template.test.ts && node --test .github/scripts/dispatch-e2e-monitor.test.mjs",
|
|
29
|
-
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
29
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
30
|
+
"record:cassettes": "RECORD_FAKE_CASSETTES=1 vitest run tests/contract/record-fake-cassettes.test.ts"
|
|
30
31
|
},
|
|
31
32
|
"keywords": [
|
|
32
33
|
"github-action",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@actions/core": "^3.0.1",
|
|
47
48
|
"@actions/exec": "^3.0.0",
|
|
48
|
-
"@postman-cse/automation-core": "^1.
|
|
49
|
+
"@postman-cse/automation-core": "^1.6.0",
|
|
49
50
|
"@postman/runtime.models": "^1.13.1",
|
|
50
51
|
"@postman/v3.export": "0.2.28",
|
|
51
52
|
"js-yaml": "^5.2.1",
|