@argos-ci/core 4.2.0 → 4.2.1-alpha.4
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/index.js +27 -5
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -341,6 +341,30 @@ function getPullRequestFromPayload(payload) {
|
|
|
341
341
|
}
|
|
342
342
|
return null;
|
|
343
343
|
}
|
|
344
|
+
function getVercelDeploymentPayload(payload) {
|
|
345
|
+
if (!payload) {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
if (process.env.GITHUB_EVENT_NAME !== "repository_dispatch") {
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
if (!("client_payload" in payload) || !("action" in payload)) {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
if (payload.action !== "vercel.deployment.success") {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
return payload;
|
|
358
|
+
}
|
|
359
|
+
function getSha(context, vercelPayload) {
|
|
360
|
+
if (vercelPayload) {
|
|
361
|
+
return vercelPayload.client_payload.git.sha;
|
|
362
|
+
}
|
|
363
|
+
if (!context.env.GITHUB_SHA) {
|
|
364
|
+
throw new Error(`GITHUB_SHA is missing`);
|
|
365
|
+
}
|
|
366
|
+
return context.env.GITHUB_SHA;
|
|
367
|
+
}
|
|
344
368
|
var service4 = {
|
|
345
369
|
name: "GitHub Actions",
|
|
346
370
|
key: "github-actions",
|
|
@@ -348,10 +372,8 @@ var service4 = {
|
|
|
348
372
|
config: async (context) => {
|
|
349
373
|
const { env } = context;
|
|
350
374
|
const payload = readEventPayload(context);
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
throw new Error(`GITHUB_SHA is missing`);
|
|
354
|
-
}
|
|
375
|
+
const vercelPayload = getVercelDeploymentPayload(payload);
|
|
376
|
+
const sha = getSha(context, vercelPayload);
|
|
355
377
|
const pullRequest = payload ? getPullRequestFromPayload(payload) : await getPullRequestFromHeadSha(context, sha);
|
|
356
378
|
return {
|
|
357
379
|
commit: sha,
|
|
@@ -361,7 +383,7 @@ var service4 = {
|
|
|
361
383
|
runId: env.GITHUB_RUN_ID || null,
|
|
362
384
|
runAttempt: env.GITHUB_RUN_ATTEMPT ? Number(env.GITHUB_RUN_ATTEMPT) : null,
|
|
363
385
|
nonce: `${env.GITHUB_RUN_ID}-${env.GITHUB_RUN_ATTEMPT}`,
|
|
364
|
-
branch: getBranchFromContext(context) || pullRequest?.head.ref || (payload ? getBranchFromPayload(payload) : null) || null,
|
|
386
|
+
branch: vercelPayload?.client_payload?.git?.ref || getBranchFromContext(context) || pullRequest?.head.ref || (payload ? getBranchFromPayload(payload) : null) || null,
|
|
365
387
|
prNumber: pullRequest?.number || null,
|
|
366
388
|
prHeadCommit: pullRequest?.head.sha ?? null,
|
|
367
389
|
prBaseBranch: pullRequest?.base.ref ?? null
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/core",
|
|
3
3
|
"description": "Node.js SDK for visual testing with Argos.",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.1-alpha.4+d1894ac",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"exports": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@argos-ci/api-client": "0.12.
|
|
44
|
-
"@argos-ci/util": "3.1.
|
|
43
|
+
"@argos-ci/api-client": "0.12.1-alpha.4+d1894ac",
|
|
44
|
+
"@argos-ci/util": "3.1.2-alpha.4+d1894ac",
|
|
45
45
|
"convict": "^6.2.4",
|
|
46
46
|
"debug": "^4.4.3",
|
|
47
47
|
"fast-glob": "^3.3.3",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@types/convict": "^6.1.6",
|
|
54
54
|
"@types/debug": "^4.1.12",
|
|
55
55
|
"@types/tmp": "^0.2.6",
|
|
56
|
+
"@vercel/repository-dispatch": "^0.1.0",
|
|
56
57
|
"msw": "^2.11.3",
|
|
57
58
|
"vitest": "catalog:"
|
|
58
59
|
},
|
|
@@ -64,5 +65,5 @@
|
|
|
64
65
|
"lint": "eslint .",
|
|
65
66
|
"test": "vitest"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "d1894acc62fb886d4673c88cc7e8cc95e81db78b"
|
|
68
69
|
}
|