Skip to content

Commit

Permalink
fix(ci): catch errors from downloadReportArtifact - log warning and p…
Browse files Browse the repository at this point in the history
…roceed
  • Loading branch information
matejchalk committed Nov 8, 2024
1 parent 8a2fd8b commit c432bb8
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions packages/ci/src/lib/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ export async function runInCI(
return { mode: 'standalone', artifacts, newIssues };
}

// eslint-disable-next-line max-lines-per-function
async function runOnProject(args: {
type RunOnProjectArgs = {
project: ProjectConfig | null;
refs: GitRefs;
api: ProviderAPIClient;
settings: Settings;
git: SimpleGit;
}): Promise<ProjectRunResult> {
};

// eslint-disable-next-line max-lines-per-function
async function runOnProject(args: RunOnProjectArgs): Promise<ProjectRunResult> {
const {
project,
refs: { head, base },
Expand Down Expand Up @@ -188,18 +190,24 @@ async function runOnProject(args: {
return { ...diffOutput, newIssues };
}

async function collectPreviousReport(args: {
project: ProjectConfig | null;
type CollectPreviousReportArgs = RunOnProjectArgs & {
base: GitBranch;
api: ProviderAPIClient;
settings: Settings;
ctx: CommandContext;
git: SimpleGit;
}): Promise<string | null> {
};

async function collectPreviousReport(
args: CollectPreviousReportArgs,
): Promise<string | null> {
const { project, base, api, settings, ctx, git } = args;
const logger = settings.logger;

const cachedBaseReport = await api.downloadReportArtifact?.(project?.name);
const cachedBaseReport = await api
.downloadReportArtifact?.(project?.name)

Check failure on line 205 in packages/ci/src/lib/run.ts

View workflow job for this annotation

GitHub Actions / Code PushUp

<✓> Code coverage | Branch coverage

1st branch is not taken in any test case.
.catch((error: unknown) => {
logger.warn(
`Error when downloading previous report artifact, skipping - ${stringifyError(error)}`,
);

Check warning on line 209 in packages/ci/src/lib/run.ts

View workflow job for this annotation

GitHub Actions / Code PushUp

<✓> Code coverage | Line coverage

Lines 207-209 are not covered in any test case.
});
if (api.downloadReportArtifact != null) {
logger.info(
`Previous report artifact ${cachedBaseReport ? 'found' : 'not found'}`,
Expand Down

0 comments on commit c432bb8

Please sign in to comment.