Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonpetgrave64 committed Apr 2, 2024
1 parent 8e08868 commit 8629f4d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion actions/installer/dist/index.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions actions/installer/spec/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe("Test validVersion", function () {
it("Rejects commit hashes", function () {
expect(
index.validVersion(
"1326430d044e8a9522c51e5f721e237b5f75acb6b4e518d129f669403cf7a79a"
)
"1326430d044e8a9522c51e5f721e237b5f75acb6b4e518d129f669403cf7a79a",
),
).toBe(false);
});
});
Expand All @@ -55,15 +55,15 @@ describe("Test fileHasExpectedSha256Hash", function () {

it("Returns false when the computed and expected hashes don't match", function () {
expect(index.fileHasExpectedSha256Hash(this.testFile, "foobar")).toBe(
false
false,
);
});
it("Returns true when the computed and expected hashes don't match", function () {
expect(
index.fileHasExpectedSha256Hash(
this.testFile,
"916f0027a575074ce72a331777c3478d6513f786a591bd892da1a577bf2335f9"
)
"916f0027a575074ce72a331777c3478d6513f786a591bd892da1a577bf2335f9",
),
).toBe(true);
});
});
Expand Down
20 changes: 10 additions & 10 deletions actions/installer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function getVerifierVersion(actionRef: string): Promise<string> {
{
owner: "slsa-framework",
repository: "slsa-verifier",
}
},
);
for (const tag of tags) {
const commitSha = tag.commit.sha;
Expand All @@ -59,14 +59,14 @@ export async function getVerifierVersion(actionRef: string): Promise<string> {
}
}
throw new Error(
`Invalid version provided: ${actionRef}. For the set of valid versions, see https://github.com/slsa-framework/slsa-verifier/releases.`
`Invalid version provided: ${actionRef}. For the set of valid versions, see https://github.com/slsa-framework/slsa-verifier/releases.`,
);
}

// If true, then the file in `path` has the same SHA256 hash as `expectedSha256Hash``.
export function fileHasExpectedSha256Hash(
filePath: string,
expectedSha256Hash: string
expectedSha256Hash: string,
): boolean {
if (!fs.existsSync(filePath)) {
throw new Error(`File not found: ${filePath}`);
Expand Down Expand Up @@ -100,7 +100,7 @@ async function run(): Promise<void> {
} catch (error: unknown) {
const errMsg = error instanceof Error ? error.message : String(error);
core.setFailed(
`Invalid version provided. For the set of valid versions, see https://github.com/slsa-framework/slsa-verifier/releases. ${errMsg}`
`Invalid version provided. For the set of valid versions, see https://github.com/slsa-framework/slsa-verifier/releases. ${errMsg}`,
);
cleanup();
return;
Expand All @@ -115,7 +115,7 @@ async function run(): Promise<void> {
// Download bootstrap version and validate SHA256 checksum
bootstrapVerifierPath = await tc.downloadTool(
`https://github.com/slsa-framework/slsa-verifier/releases/download/${BOOTSTRAP_VERSION}/slsa-verifier-linux-amd64`,
`${bootstrapDir}/${BINARY_NAME}`
`${bootstrapDir}/${BINARY_NAME}`,
);
} catch (error: unknown) {
const errMsg = error instanceof Error ? error.message : String(error);
Expand All @@ -128,7 +128,7 @@ async function run(): Promise<void> {
!fileHasExpectedSha256Hash(bootstrapVerifierPath, BOOTSTRAP_VERIFIER_SHA256)
) {
core.setFailed(
`Unable to verify slsa-verifier checksum. Aborting installation.`
`Unable to verify slsa-verifier checksum. Aborting installation.`,
);
cleanup();
return;
Expand All @@ -141,7 +141,7 @@ async function run(): Promise<void> {
// Download requested version binary and provenance
downloadedBinaryPath = await tc.downloadTool(
`https://github.com/slsa-framework/slsa-verifier/releases/download/${version}/slsa-verifier-linux-amd64`,
`${installDir}/${BINARY_NAME}`
`${installDir}/${BINARY_NAME}`,
);
} catch (error: unknown) {
const errMsg = error instanceof Error ? error.message : String(error);
Expand All @@ -153,7 +153,7 @@ async function run(): Promise<void> {
try {
downloadedProvenancePath = await tc.downloadTool(
`https://github.com/slsa-framework/slsa-verifier/releases/download/${version}/slsa-verifier-linux-amd64.intoto.jsonl`,
`${installDir}/${PROVENANCE_NAME}`
`${installDir}/${PROVENANCE_NAME}`,
);
} catch (error: unknown) {
const errMsg = error instanceof Error ? error.message : String(error);
Expand All @@ -175,11 +175,11 @@ async function run(): Promise<void> {
"github.com/slsa-framework/slsa-verifier",
"--source-tag",
version,
]
],
);
if (exitCode !== 0) {
throw new Error(
`Unable to verify binary provenance. Aborting installation. stdout: ${stdout}; stderr: ${stderr}`
`Unable to verify binary provenance. Aborting installation. stdout: ${stdout}; stderr: ${stderr}`,
);
}
} catch (error: unknown) {
Expand Down

0 comments on commit 8629f4d

Please sign in to comment.