Skip to content

Commit

Permalink
fix: fallback on default configuration is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-de-Jong committed Apr 10, 2024
1 parent df1930d commit 3da69fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions lib/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as core from "@actions/core";
import * as github from "@actions/github";
import { ConventionalCommit } from "@dev-build-deploy/commit-it";
import { CalVerIncrement, SemVerIncrement } from "@dev-build-deploy/version-it";
import { RequestError } from "@octokit/request-error";
import YAML from "yaml";

import * as thisModule from "./changelog";
Expand Down Expand Up @@ -71,10 +72,14 @@ export async function getConfigurationFromAPI(): Promise<IReleaseConfiguration |
return YAML.parse(content) as IReleaseConfiguration;
}
} catch (error) {
if ((error as Error).message !== "Not Found") {
throw error;
if (error instanceof RequestError && error.response) {
const reponseData = error.response.data as Record<string, unknown>;
if ("message" in reponseData && reponseData.message === "Not Found") {
core.info("No release configuration found, using default configuration");
return;
}
}
core.info("No release configuration found, using default configuration");
throw error;
}
return;
}
Expand Down

0 comments on commit 3da69fa

Please sign in to comment.