Skip to content

Commit 28f36d1

Browse files
committed
really fix me
1 parent dc4fd7c commit 28f36d1

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

dev-packages/size-limit-gh-action/index.mjs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ async function run() {
229229
let current;
230230

231231
try {
232-
core.info('Downloading base results...');
232+
core.warning('Downloading base results...');
233233
const artifacts = await getArtifactsForBranchAndWorkflow(octokit, {
234234
...repo,
235235
artifactName: ARTIFACT_NAME,
236236
branch: comparisonBranch,
237237
workflowName: `${process.env.GITHUB_WORKFLOW || ''}`,
238238
});
239-
core.info('Fetched artifacts for base results');
239+
core.warning('Fetched artifacts for base results');
240240

241241
if (!artifacts) {
242242
throw new Error('No artifacts found');
@@ -249,7 +249,7 @@ async function run() {
249249
downloadPath: __dirname,
250250
});
251251

252-
core.info('Downloaded base results');
252+
core.warning('Downloaded base results');
253253
base = JSON.parse(await fs.readFile(resultsFilePath, { encoding: 'utf8' }));
254254
} catch (error) {
255255
core.startGroup('Warning, unable to find base results');
@@ -352,7 +352,7 @@ export async function getArtifactsForBranchAndWorkflow(octokit, { owner, repo, w
352352
}
353353

354354
if (!repositoryWorkflow) {
355-
core.info(
355+
core.warning(
356356
`Unable to find workflow with name "${workflowName}" in the repository. Found workflows: ${allWorkflows.join(
357357
', ',
358358
)}`,
@@ -362,19 +362,20 @@ export async function getArtifactsForBranchAndWorkflow(octokit, { owner, repo, w
362362
}
363363

364364
const workflow_id = repositoryWorkflow.id;
365-
core.info(repositoryWorkflow);
365+
core.warning(repositoryWorkflow);
366366

367367
let currentPage = 0;
368368
const completedWorkflowRuns = [];
369369

370-
core.info('Get runs for:');
370+
core.warning('Get runs for:');
371371
console.log({
372372
workflow_id,
373373
branch,
374374
status: 'success',
375375
per_page: DEFAULT_PAGE_LIMIT,
376376
event: 'push',
377377
});
378+
console.log('compare with', `${owner}/${repo}`)
378379

379380
for await (const response of octokit.paginate.iterator(octokit.rest.actions.listWorkflowRuns, {
380381
owner,
@@ -385,7 +386,6 @@ export async function getArtifactsForBranchAndWorkflow(octokit, { owner, repo, w
385386
per_page: DEFAULT_PAGE_LIMIT,
386387
event: 'push',
387388
})) {
388-
console.log('response', response.data.length);
389389
if (!response.data.length) {
390390
core.warning(`Workflow ${workflow_id} not found in branch ${branch}`);
391391
core.endGroup();
@@ -397,8 +397,8 @@ export async function getArtifactsForBranchAndWorkflow(octokit, { owner, repo, w
397397
...response.data.filter(workflowRun => workflowRun.head_repository.full_name === `${owner}/${repo}`),
398398
);
399399

400-
if (!completedWorkflowRuns.length) {
401-
continue;
400+
if (completedWorkflowRuns.length) {
401+
break;
402402
}
403403

404404
if (currentPage > DEFAULT_MAX_PAGES) {
@@ -410,9 +410,11 @@ export async function getArtifactsForBranchAndWorkflow(octokit, { owner, repo, w
410410
currentPage++;
411411
}
412412

413+
console.log('completed workflows', completedWorkflowRuns.length);
414+
413415
// Search through workflow artifacts until we find a workflow run w/ artifact name that we are looking for
414416
for (const workflowRun of completedWorkflowRuns) {
415-
core.info(`Checking artifacts for workflow run: ${workflowRun.html_url}`);
417+
core.warning(`Checking artifacts for workflow run: ${workflowRun.html_url}`);
416418

417419
const {
418420
data: { artifacts },
@@ -423,13 +425,13 @@ export async function getArtifactsForBranchAndWorkflow(octokit, { owner, repo, w
423425
});
424426

425427
if (!artifacts) {
426-
core.info(
428+
core.warning(
427429
`Unable to fetch artifacts for branch: ${branch}, workflow: ${workflow_id}, workflowRunId: ${workflowRun.id}`,
428430
);
429431
} else {
430432
const foundArtifact = artifacts.find(({ name }) => name === artifactName);
431433
if (foundArtifact) {
432-
core.info(`Found suitable artifact: ${foundArtifact.url}`);
434+
core.warning(`Found suitable artifact: ${foundArtifact.url}`);
433435
return {
434436
artifact: foundArtifact,
435437
workflowRun,

0 commit comments

Comments
 (0)