@argos-ci/core 0.4.2-alpha.4 → 0.4.2-alpha.6

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 +25 -8
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -88,6 +88,11 @@ const schema = {
88
88
  default: null,
89
89
  nullable: true
90
90
  },
91
+ runId: {
92
+ format: String,
93
+ default: null,
94
+ nullable: true
95
+ },
91
96
  owner: {
92
97
  format: String,
93
98
  default: null,
@@ -125,7 +130,8 @@ const service$1 = {
125
130
  branch: env.HEROKU_TEST_RUN_BRANCH || null,
126
131
  owner: null,
127
132
  repository: null,
128
- jobId: env.HEROKU_TEST_RUN_ID || null
133
+ jobId: env.HEROKU_TEST_RUN_ID || null,
134
+ runId: null
129
135
  })
130
136
  };
131
137
 
@@ -173,6 +179,10 @@ function getBranch({ env }) {
173
179
  }
174
180
  return null;
175
181
  }
182
+ function getRepository({ env }) {
183
+ if (!env.GITHUB_REPOSITORY) return null;
184
+ return env.GITHUB_REPOSITORY.split("/")[1];
185
+ }
176
186
  const service = {
177
187
  detect: ({ env })=>Boolean(env.GITHUB_ACTIONS),
178
188
  config: ({ env })=>({
@@ -184,8 +194,11 @@ const service = {
184
194
  env
185
195
  }),
186
196
  owner: env.GITHUB_REPOSITORY_OWNER || null,
187
- repository: env.GITHUB_REPOSITORY || null,
188
- jobId: env.GITHUB_JOB || null
197
+ repository: getRepository({
198
+ env
199
+ }),
200
+ jobId: env.GITHUB_JOB || null,
201
+ runId: env.GITHUB_RUN_ID || null
189
202
  })
190
203
  };
191
204
 
@@ -211,13 +224,15 @@ const getCiEnvironment = ({ env =process.env } = {})=>{
211
224
  const owner = slug ? slug[0] : null;
212
225
  const repository = slug ? slug[1] : null;
213
226
  const jobId = ciContext.job ?? null;
227
+ const runId = null;
214
228
  return commit ? {
215
229
  name,
216
230
  commit,
217
231
  branch,
218
232
  owner,
219
233
  repository,
220
- jobId
234
+ jobId,
235
+ runId
221
236
  } : null;
222
237
  };
223
238
 
@@ -277,18 +292,19 @@ const hashFile = async (filepath)=>{
277
292
  };
278
293
 
279
294
  const base64Encode = (obj)=>Buffer.from(JSON.stringify(obj), "utf8").toString("base64");
280
- const getBearerToken = ({ token , ciService , owner , repository , jobId })=>{
295
+ const getBearerToken = ({ token , ciService , owner , repository , jobId , runId })=>{
281
296
  if (token) return `Bearer ${token}`;
282
297
  switch(ciService){
283
298
  case "GitHub Actions":
284
299
  {
285
- if (!owner || !repository || !jobId) {
300
+ if (!owner || !repository || !jobId || !runId) {
286
301
  throw new Error(`Automatic ${ciService} variables detection failed. Please add the 'ARGOS_TOKEN'`);
287
302
  }
288
303
  return `Bearer tokenless-github-${base64Encode({
289
304
  owner,
290
305
  repository,
291
- jobId
306
+ jobId,
307
+ runId
292
308
  })}`;
293
309
  }
294
310
  default:
@@ -380,7 +396,8 @@ const getConfigFromOptions = (options)=>{
380
396
  ciService: ciEnv.name,
381
397
  owner: ciEnv.owner,
382
398
  repository: ciEnv.repository,
383
- jobId: ciEnv.jobId
399
+ jobId: ciEnv.jobId,
400
+ runId: ciEnv.runId
384
401
  }));
385
402
  }
386
403
  }
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": "0.4.2-alpha.4+ed31a51",
4
+ "version": "0.4.2-alpha.6+3ace924",
5
5
  "scripts": {
6
6
  "prebuild": "rm -rf dist",
7
7
  "build": "rollup -c",
@@ -60,5 +60,5 @@
60
60
  "rollup-plugin-dts": "^4.2.2",
61
61
  "rollup-plugin-swc3": "^0.3.0"
62
62
  },
63
- "gitHead": "ed31a517cf4c01a71843f6c5a2a0f7c83279ebf5"
63
+ "gitHead": "3ace9249c7e55c5e0e2ae176b203f6807005b872"
64
64
  }