@argos-ci/core 0.4.2-alpha.4 → 0.4.2-alpha.5
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.mjs +26 -8
- 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,11 @@ function getBranch({ env }) {
|
|
|
173
179
|
}
|
|
174
180
|
return null;
|
|
175
181
|
}
|
|
182
|
+
function getRepository({ env }) {
|
|
183
|
+
if (!env.GITHUB_REPOSITORY_OWNER) return null;
|
|
184
|
+
const [, ...repositoryParts] = env.GITHUB_REPOSITORY_OWNER.split("/");
|
|
185
|
+
return repositoryParts.join("/");
|
|
186
|
+
}
|
|
176
187
|
const service = {
|
|
177
188
|
detect: ({ env })=>Boolean(env.GITHUB_ACTIONS),
|
|
178
189
|
config: ({ env })=>({
|
|
@@ -184,8 +195,11 @@ const service = {
|
|
|
184
195
|
env
|
|
185
196
|
}),
|
|
186
197
|
owner: env.GITHUB_REPOSITORY_OWNER || null,
|
|
187
|
-
repository:
|
|
188
|
-
|
|
198
|
+
repository: getRepository({
|
|
199
|
+
env
|
|
200
|
+
}),
|
|
201
|
+
jobId: env.GITHUB_JOB || null,
|
|
202
|
+
runId: env.GITHUB_RUN_ID || null
|
|
189
203
|
})
|
|
190
204
|
};
|
|
191
205
|
|
|
@@ -211,13 +225,15 @@ const getCiEnvironment = ({ env =process.env } = {})=>{
|
|
|
211
225
|
const owner = slug ? slug[0] : null;
|
|
212
226
|
const repository = slug ? slug[1] : null;
|
|
213
227
|
const jobId = ciContext.job ?? null;
|
|
228
|
+
const runId = null;
|
|
214
229
|
return commit ? {
|
|
215
230
|
name,
|
|
216
231
|
commit,
|
|
217
232
|
branch,
|
|
218
233
|
owner,
|
|
219
234
|
repository,
|
|
220
|
-
jobId
|
|
235
|
+
jobId,
|
|
236
|
+
runId
|
|
221
237
|
} : null;
|
|
222
238
|
};
|
|
223
239
|
|
|
@@ -277,18 +293,19 @@ const hashFile = async (filepath)=>{
|
|
|
277
293
|
};
|
|
278
294
|
|
|
279
295
|
const base64Encode = (obj)=>Buffer.from(JSON.stringify(obj), "utf8").toString("base64");
|
|
280
|
-
const getBearerToken = ({ token , ciService , owner , repository , jobId })=>{
|
|
296
|
+
const getBearerToken = ({ token , ciService , owner , repository , jobId , runId })=>{
|
|
281
297
|
if (token) return `Bearer ${token}`;
|
|
282
298
|
switch(ciService){
|
|
283
299
|
case "GitHub Actions":
|
|
284
300
|
{
|
|
285
|
-
if (!owner || !repository || !jobId) {
|
|
301
|
+
if (!owner || !repository || !jobId || !runId) {
|
|
286
302
|
throw new Error(`Automatic ${ciService} variables detection failed. Please add the 'ARGOS_TOKEN'`);
|
|
287
303
|
}
|
|
288
304
|
return `Bearer tokenless-github-${base64Encode({
|
|
289
305
|
owner,
|
|
290
306
|
repository,
|
|
291
|
-
jobId
|
|
307
|
+
jobId,
|
|
308
|
+
runId
|
|
292
309
|
})}`;
|
|
293
310
|
}
|
|
294
311
|
default:
|
|
@@ -380,7 +397,8 @@ const getConfigFromOptions = (options)=>{
|
|
|
380
397
|
ciService: ciEnv.name,
|
|
381
398
|
owner: ciEnv.owner,
|
|
382
399
|
repository: ciEnv.repository,
|
|
383
|
-
jobId: ciEnv.jobId
|
|
400
|
+
jobId: ciEnv.jobId,
|
|
401
|
+
runId: ciEnv.runId
|
|
384
402
|
}));
|
|
385
403
|
}
|
|
386
404
|
}
|
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
|
+
"version": "0.4.2-alpha.5+ac9a461",
|
|
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": "
|
|
63
|
+
"gitHead": "ac9a46182e464e332ca72dfca03a5665586f7aff"
|
|
64
64
|
}
|