mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-21 15:31:46 +02:00
fix: accept nullable workflow metadata
This commit is contained in:
@@ -37,10 +37,13 @@ const tagSchema = {
|
||||
},
|
||||
},
|
||||
};
|
||||
const workflowRunsSchema = collectionSchema('workflow_runs');
|
||||
const workflowRunsSchema = collectionSchema('workflow_runs', true);
|
||||
const checkRunsSchema = collectionSchema('check_runs');
|
||||
|
||||
function collectionSchema(property) {
|
||||
function collectionSchema(property, nullableWorkflowFields = false) {
|
||||
const nameAndStatusSchema = nullableWorkflowFields
|
||||
? { anyOf: [{ type: 'string' }, { type: 'null' }] }
|
||||
: { type: 'string' };
|
||||
return {
|
||||
type: 'object',
|
||||
required: [property],
|
||||
@@ -52,9 +55,9 @@ function collectionSchema(property) {
|
||||
required: ['id', 'name', 'head_sha', 'status', 'conclusion'],
|
||||
properties: {
|
||||
id: { type: 'integer' },
|
||||
name: { type: 'string' },
|
||||
name: nameAndStatusSchema,
|
||||
head_sha: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
status: nameAndStatusSchema,
|
||||
conclusion: { anyOf: [{ type: 'string' }, { type: 'null' }] },
|
||||
},
|
||||
},
|
||||
@@ -129,11 +132,11 @@ function nextPageUrl(linkHeader, repository) {
|
||||
}
|
||||
|
||||
async function githubApiPages(path, itemsKey, inputs, fetchImpl, schema) {
|
||||
const items = [];
|
||||
let items = [];
|
||||
let next = path;
|
||||
while (next) {
|
||||
const page = await githubApiPage(next, inputs, fetchImpl, schema);
|
||||
items.push(...page.payload[itemsKey]);
|
||||
items = [...items, ...page.payload[itemsKey]];
|
||||
next = page.next;
|
||||
}
|
||||
return items;
|
||||
|
||||
@@ -19,13 +19,16 @@ const lifecycleRunnerSource = load('tests/ci/packed-artifact-lifecycle.js');
|
||||
|
||||
let passed = 0;
|
||||
let failed = 0;
|
||||
const pendingTests = [];
|
||||
let pendingTests = [];
|
||||
|
||||
function test(name, fn) {
|
||||
try {
|
||||
const result = fn();
|
||||
if (result && typeof result.then === 'function') {
|
||||
pendingTests.push(result.then(() => pass(name), error => fail(name, error)));
|
||||
pendingTests = [
|
||||
...pendingTests,
|
||||
result.then(() => pass(name), error => fail(name, error)),
|
||||
];
|
||||
} else {
|
||||
pass(name);
|
||||
}
|
||||
@@ -267,6 +270,13 @@ test('release gate verifier evaluates checks from every GitHub result page', asy
|
||||
return response({
|
||||
workflow_runs: [
|
||||
{ id: 1, name: 'CI', head_sha: releaseSha, status: 'completed', conclusion: 'success' },
|
||||
{
|
||||
id: 3,
|
||||
name: null,
|
||||
head_sha: 'b'.repeat(40),
|
||||
status: null,
|
||||
conclusion: null,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user