Skip to content

Commit

Permalink
Formatted with Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mateumiralles committed Dec 18, 2023
1 parent a99dbaa commit b06b0cf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/commands/githubActions/bumpUpstream/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function getUpstreamVersionTag(
}

//Checking if the proposed realease is nightly or realeaseCandidate
export function isUndesiredRealease(version:string ) :boolean{
export function isUndesiredRealease(version: string): boolean {
const regexPattern = /-rc\.|-RC\.|nightly/;
return regexPattern.test(version);
}
}
12 changes: 8 additions & 4 deletions src/commands/githubActions/bumpUpstream/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { CommandModule } from "yargs";
import { CliGlobalOptions } from "../../../types.js";
import { branchNameRoot, defaultDir } from "../../../params.js";
import { Github } from "../../../providers/github/Github.js";
import { isUndesiredRealease, getPrBody, getUpstreamVersionTag, VersionToUpdate } from "./format.js";
import {
isUndesiredRealease,
getPrBody,
getUpstreamVersionTag,
VersionToUpdate
} from "./format.js";
import { shell } from "../../../utils/shell.js";
import { parseCsv } from "../../../utils/csv.js";
import { getLocalBranchExists, getGitHead } from "../../../utils/git.js";
Expand Down Expand Up @@ -125,7 +130,8 @@ Compose - ${JSON.stringify(compose, null, 2)}
const argName = upstreamArgs[i];
const newVersion = latestRelease.tag_name;

if (isUndesiredRealease(newVersion)) throw Error(`This is a realease candidate`);
if (isUndesiredRealease(newVersion))
throw Error(`This is a realease candidate`);
upstreamRepoVersions.set(argName, { repo, repoSlug, newVersion });

console.log(`Fetch latest version(s) - ${repoSlug}: ${newVersion}`);
Expand Down Expand Up @@ -203,7 +209,6 @@ Compose - ${JSON.stringify(compose, null, 2)}
dir
});
} catch (e) {

if (e.message.includes("NOREPO")) {
console.log("Package not found in APM (probably not published yet");
console.log("Manifest version set to default 0.1.0");
Expand All @@ -212,7 +217,6 @@ Compose - ${JSON.stringify(compose, null, 2)}
e.message = `Error getting next version from apm: ${e.message}`;
throw e;
}

}

writeManifest(manifest, format, { dir });
Expand Down
17 changes: 4 additions & 13 deletions test/commands/gaBumpUpstream/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,19 @@ describe("command / gaBumpUpstream / format", () => {
newVersion: "nightly",
currentVersion: "v23.3.2"
}

];

it("isDesiredRealease", () => {
expect(isUndesiredRealease(versionsToUpdate[0].newVersion)).equal(
false
);
expect(isUndesiredRealease(versionsToUpdate[0].newVersion)).equal(false);
});
it("isRealeaseCandidate", () => {
expect(isUndesiredRealease(versionsToUpdate[1].newVersion)).equal(
true
);
expect(isUndesiredRealease(versionsToUpdate[1].newVersion)).equal(true);
});
it("isRealeaseCandidate", () => {
expect(isUndesiredRealease(versionsToUpdate[2].newVersion)).equal(
true
);
expect(isUndesiredRealease(versionsToUpdate[2].newVersion)).equal(true);
});
it("isNightlyRealease", () => {
expect(isUndesiredRealease(versionsToUpdate[3].newVersion)).equal(
true
);
expect(isUndesiredRealease(versionsToUpdate[3].newVersion)).equal(true);
});
});
});

0 comments on commit b06b0cf

Please sign in to comment.