@argos-ci/core 2.4.2-alpha.4 → 2.4.2-alpha.7

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.mjs +14 -20
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -48,7 +48,7 @@ import { createRequire } from 'node:module';
48
48
  function getMergeBaseCommitShaWithDepth(input) {
49
49
  const head = input.head || `HEAD`;
50
50
  try {
51
- execSync(`git fetch origin ${head} --depth ${input.depth}`);
51
+ execSync(`git fetch origin ${head}:${head} --depth ${input.depth}`);
52
52
  execSync(`git fetch origin ${input.base}:${input.base} --depth ${input.depth}`);
53
53
  const mergeBase = execSync(`git merge-base ${head} ${input.base}`).toString().trim();
54
54
  return mergeBase || null;
@@ -60,8 +60,8 @@ function getMergeBaseCommitSha$1(input) {
60
60
  let depth = 50;
61
61
  while(depth < 1000){
62
62
  const mergeBase = getMergeBaseCommitShaWithDepth({
63
- ...input,
64
- depth
63
+ depth,
64
+ ...input
65
65
  });
66
66
  if (mergeBase) {
67
67
  return mergeBase;
@@ -273,16 +273,7 @@ const service$4 = {
273
273
  prHeadCommit: payload?.pull_request?.head.sha ?? null
274
274
  };
275
275
  },
276
- getMergeBaseCommitSha: (input, ctx)=>{
277
- const payload = readEventPayload(ctx);
278
- const branch = getBranch(ctx, payload);
279
- // Unshallow the repository to get the merge base commit
280
- execSync(`git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"`);
281
- return getMergeBaseCommitSha$1({
282
- base: input.base,
283
- head: branch
284
- });
285
- }
276
+ getMergeBaseCommitSha: getMergeBaseCommitSha$1
286
277
  };
287
278
 
288
279
  const getPrNumber$1 = ({ env })=>{
@@ -682,15 +673,17 @@ const hashFile = async (filepath)=>{
682
673
  };
683
674
 
684
675
  const base64Encode = (obj)=>Buffer.from(JSON.stringify(obj), "utf8").toString("base64");
685
- function getBearerToken({ token, ciProvider, owner, repository, jobId, runId, prNumber }) {
686
- if (token) return `Bearer ${token}`;
676
+ function getAuthToken({ token, ciProvider, owner, repository, jobId, runId, prNumber }) {
677
+ if (token) {
678
+ return token;
679
+ }
687
680
  switch(ciProvider){
688
681
  case "github-actions":
689
682
  {
690
683
  if (!owner || !repository || !jobId || !runId) {
691
684
  throw new Error(`Automatic GitHub Actions variables detection failed. Please add the 'ARGOS_TOKEN'`);
692
685
  }
693
- return `Bearer tokenless-github-${base64Encode({
686
+ return `tokenless-github-${base64Encode({
694
687
  owner,
695
688
  repository,
696
689
  jobId,
@@ -831,14 +824,14 @@ async function uploadFilesToS3(files) {
831
824
  "**/*.{png,jpg,jpeg}"
832
825
  ];
833
826
  debug("Using config and files", config, files);
834
- const authToken = getBearerToken(config);
827
+ const authToken = getAuthToken(config);
835
828
  const apiClient = createClient({
836
829
  baseUrl: config.apiBaseUrl,
837
- authToken: authToken
830
+ authToken
838
831
  });
839
832
  const legacyApiClient = createArgosLegacyAPIClient({
840
833
  baseUrl: config.apiBaseUrl,
841
- bearerToken: authToken
834
+ bearerToken: `Bearer ${authToken}`
842
835
  });
843
836
  // Collect screenshots
844
837
  const foundScreenshots = await discoverScreenshots(files, {
@@ -891,7 +884,8 @@ async function uploadFilesToS3(files) {
891
884
  return null;
892
885
  }
893
886
  const sha = getMergeBaseCommitSha({
894
- base: referenceBranch
887
+ base: referenceBranch,
888
+ head: config.branch
895
889
  });
896
890
  if (sha) {
897
891
  debug("Found reference commit from git", sha);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/core",
3
3
  "description": "Visual testing solution to avoid visual regression. The core component of Argos SDK that handles build creation.",
4
- "version": "2.4.2-alpha.4+4b6e8a3",
4
+ "version": "2.4.2-alpha.7+3eb419d",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "types": "./dist/index.d.ts",
@@ -40,8 +40,8 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
- "@argos-ci/api-client": "0.1.1-alpha.32+4b6e8a3",
44
- "@argos-ci/util": "2.1.1-alpha.12+4b6e8a3",
43
+ "@argos-ci/api-client": "0.1.1-alpha.35+3eb419d",
44
+ "@argos-ci/util": "2.1.1-alpha.15+3eb419d",
45
45
  "axios": "^1.7.4",
46
46
  "convict": "^6.2.4",
47
47
  "debug": "^4.3.6",
@@ -60,5 +60,5 @@
60
60
  "build": "rollup -c",
61
61
  "e2e": "node ./e2e/upload.cjs && node ./e2e/upload.mjs"
62
62
  },
63
- "gitHead": "4b6e8a36627d466e65859396ec6cfee717ba7c7b"
63
+ "gitHead": "3eb419d3b661bf705619e1ec869cc73e05165b53"
64
64
  }