diff --git a/__tests__/configFile.test.ts b/__tests__/configFile.test.ts index 89fd09e..3b772eb 100644 --- a/__tests__/configFile.test.ts +++ b/__tests__/configFile.test.ts @@ -1,5 +1,5 @@ import configFile from "../src/configFile"; -import { parse } from "toml"; +import {parse} from "toml"; test("get off my back, Jest", () => { expect(5).toEqual(5); @@ -13,7 +13,9 @@ test("checkSameOrgToolSpec same org", () => { tool3 = { source = "org1/tool3", version = "1.0.0" }\n `; let manifestContent = parse(config); - expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1")).toEqual(true); + expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1")).toEqual( + true + ); }); test("checkSameOrgToolSpec different org", () => { @@ -24,5 +26,7 @@ test("checkSameOrgToolSpec different org", () => { tool3 = { source = "org1/tool3", version = "1.0.0" }\n `; let manifestContent = parse(config); - expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1")).toEqual(false); + expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1")).toEqual( + false + ); }); diff --git a/src/configFile.ts b/src/configFile.ts index a0fdcb0..c86bcb8 100644 --- a/src/configFile.ts +++ b/src/configFile.ts @@ -1,9 +1,9 @@ -import { parse } from "toml"; -import { readFile } from "fs"; +import {parse} from "toml"; +import {readFile} from "fs"; import findUp from "find-up"; interface foremanConfig { tools: { - [tool_name: string]: foremanTool + [tool_name: string]: foremanTool; }; } @@ -16,7 +16,10 @@ interface foremanTool { const MANIFEST = "foreman.toml"; -function checkSameOrgToolSpecs(manifestContent: foremanConfig, org: string): boolean { +function checkSameOrgToolSpecs( + manifestContent: foremanConfig, + org: string +): boolean { const tools = manifestContent.tools; if (tools == null) { throw new Error("Tools section in Foreman config not found"); @@ -42,10 +45,10 @@ function checkSameOrgToolSpecs(manifestContent: foremanConfig, org: string): boo } if (tool_org != org) { - return false + return false; } } - return true + return true; } async function checkSameOrgInConfig(org: string): Promise { @@ -61,7 +64,9 @@ async function checkSameOrgInConfig(org: string): Promise { const manifestContent = parse(data); const sameGithubOrgSource = checkSameOrgToolSpecs(manifestContent, org); if (sameGithubOrgSource == false) { - throw new Error(`All GitHub orgs in Foreman config must match the org setup-foreman runs in: ${org}. To disable this check, set the \"allow-external-github-orgs\" option to true.`); + throw new Error( + `All GitHub orgs in Foreman config must match the org setup-foreman runs in: ${org}. To disable this check, set the \"allow-external-github-orgs\" option to true.` + ); } }); } diff --git a/src/foreman.ts b/src/foreman.ts index 6120e2e..718a5c9 100644 --- a/src/foreman.ts +++ b/src/foreman.ts @@ -1,6 +1,6 @@ -import { addPath } from "@actions/core"; -import { exec } from "@actions/exec"; -import { GitHub } from "@actions/github"; +import {addPath} from "@actions/core"; +import {exec} from "@actions/exec"; +import {GitHub} from "@actions/github"; import semver from "semver"; import os from "os"; diff --git a/src/main.ts b/src/main.ts index f0cabb9..9297566 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,17 +16,13 @@ async function run(): Promise { ).toLowerCase(); if (allowExternalGithubOrgs != "true") { - let repo = context.payload.repository; + const repo = context.payload.repository; if (repo == null) { - throw new Error( - `Could not find repository` - ) + throw new Error(`Could not find repository`); } - let org = repo.owner.name; + const org = repo.owner.name; if (org == null) { - throw new Error( - `Could not find owner of the repository` - ) + throw new Error(`Could not find owner of the repository`); } configFile.checkSameOrgInConfig(org); }