Skip to content

Commit

Permalink
Allow running a build on a single commit repo w/ option
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Sep 6, 2023
1 parent a5e8204 commit 7d6d948
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions node-src/git/getCommitAndBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface CommitInfo {
}

export default async function getCommitAndBranch(
{ log },
{ log, options },
{
branchName,
patchBaseRef,
Expand Down Expand Up @@ -56,7 +56,7 @@ export default async function getCommitAndBranch(
const isGitHubAction = GITHUB_ACTIONS === 'true';
const isGitHubPrBuild = GITHUB_EVENT_NAME === 'pull_request';

if (!(await hasPreviousCommit())) {
if (!options.allowSingleCommitRepositories && !(await hasPreviousCommit())) {
throw new Error(gitOneCommit(isGitHubAction));
}

Expand Down
2 changes: 2 additions & 0 deletions node-src/lib/getOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export default function getOptions({ argv, env, flags, log, packageJson }: Conte
branchName,
patchHeadRef,
patchBaseRef,

allowSingleCommitRepositories: false,
};

if (flags.debug) {
Expand Down
3 changes: 3 additions & 0 deletions node-src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export interface Options {
patchHeadRef: string;
patchBaseRef: string;

/** Allow builds on repositories with only one git commit */
allowSingleCommitRepositories: boolean;

/** A callback that is called at the completion of each task */
onTaskComplete?: (ctx: Context) => void;

Expand Down

0 comments on commit 7d6d948

Please sign in to comment.