@argos-ci/core 5.1.0 → 5.1.1

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -431,12 +431,22 @@ function getRepository3(context, payload) {
431
431
  }
432
432
  return getGitHubRepository(context);
433
433
  }
434
- function getSha(context, vercelPayload) {
434
+ function getSha(context, vercelPayload, payload) {
435
+ if (context.env.GITHUB_EVENT_NAME === "pull_request_target") {
436
+ if (!payload) {
437
+ throw new Error('Payload is missing in "pull_request_target" event');
438
+ }
439
+ const pullRequest = getPullRequestFromPayload(payload);
440
+ if (!pullRequest) {
441
+ throw new Error('Pull request missing in "pull_request_target" event');
442
+ }
443
+ return pullRequest.head.sha;
444
+ }
435
445
  if (vercelPayload) {
436
446
  return vercelPayload.client_payload.git.sha;
437
447
  }
438
448
  if (!context.env.GITHUB_SHA) {
439
- throw new Error(`GITHUB_SHA is missing`);
449
+ throw new Error("GITHUB_SHA is missing");
440
450
  }
441
451
  return context.env.GITHUB_SHA;
442
452
  }
@@ -483,7 +493,7 @@ var service4 = {
483
493
  const payload = readEventPayload(context);
484
494
  const vercelPayload = getVercelDeploymentPayload(payload);
485
495
  const mergeGroupPayload = getMergeGroupPayload(payload);
486
- const sha = getSha(context, vercelPayload);
496
+ const sha = getSha(context, vercelPayload, payload);
487
497
  const pullRequest = await getPullRequest({
488
498
  payload,
489
499
  vercelPayload,
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": "5.1.0",
4
+ "version": "5.1.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "exports": {
@@ -67,5 +67,5 @@
67
67
  "lint": "eslint .",
68
68
  "test": "vitest"
69
69
  },
70
- "gitHead": "6887164dc0ccd5b2a3dd1d7d9e778cdbbdd2d534"
70
+ "gitHead": "52b2c59dc89e972ea9951dc7a94bf8f7d7922e4a"
71
71
  }