From abdf74a01c347b722b9e43ebac86e1b9eac3cc26 Mon Sep 17 00:00:00 2001
From: Cory Miller <13227161+cory-miller@users.noreply.github.com>
Date: Tue, 23 Apr 2024 19:14:22 +0000
Subject: [PATCH] Format files

---
 __test__/git-auth-helper.test.ts |  8 ++++----
 __test__/ref-helper.test.ts      |  4 ++--
 __test__/retry-helper.test.ts    |  2 +-
 dist/index.js                    |  6 +++---
 src/fs-helper.ts                 | 15 +++++++++------
 src/git-auth-helper.ts           |  2 +-
 src/input-helper.ts              |  5 +++--
 src/ref-helper.ts                |  2 +-
 src/workflow-context-helper.ts   |  5 +++--
 9 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/__test__/git-auth-helper.test.ts b/__test__/git-auth-helper.test.ts
index 694c0ba..7633704 100644
--- a/__test__/git-auth-helper.test.ts
+++ b/__test__/git-auth-helper.test.ts
@@ -169,8 +169,9 @@ describe('git-auth-helper tests', () => {
 
     // Mock fs.promises.readFile
     const realReadFile = fs.promises.readFile
-    jest.spyOn(fs.promises, 'readFile').mockImplementation(
-      async (file: any, options: any): Promise<Buffer> => {
+    jest
+      .spyOn(fs.promises, 'readFile')
+      .mockImplementation(async (file: any, options: any): Promise<Buffer> => {
         const userKnownHostsPath = path.join(
           os.homedir(),
           '.ssh',
@@ -181,8 +182,7 @@ describe('git-auth-helper tests', () => {
         }
 
         return await realReadFile(file, options)
-      }
-    )
+      })
 
     // Act
     const authHelper = gitAuthHelper.createAuthHelper(git, settings)
diff --git a/__test__/ref-helper.test.ts b/__test__/ref-helper.test.ts
index 0801532..8a8302a 100644
--- a/__test__/ref-helper.test.ts
+++ b/__test__/ref-helper.test.ts
@@ -7,11 +7,11 @@ let git: IGitCommandManager
 
 describe('ref-helper tests', () => {
   beforeEach(() => {
-    git = ({} as unknown) as IGitCommandManager
+    git = {} as unknown as IGitCommandManager
   })
 
   it('getCheckoutInfo requires git', async () => {
-    const git = (null as unknown) as IGitCommandManager
+    const git = null as unknown as IGitCommandManager
     try {
       await refHelper.getCheckoutInfo(git, 'refs/heads/my/branch', commit)
       throw new Error('Should not reach here')
diff --git a/__test__/retry-helper.test.ts b/__test__/retry-helper.test.ts
index b4cb999..a5d3f79 100644
--- a/__test__/retry-helper.test.ts
+++ b/__test__/retry-helper.test.ts
@@ -68,7 +68,7 @@ describe('retry-helper tests', () => {
 
   it('all attempts fail succeeds', async () => {
     let attempts = 0
-    let error: Error = (null as unknown) as Error
+    let error: Error = null as unknown as Error
     try {
       await retryHelper.execute(() => {
         throw new Error(`some error ${++attempts}`)
diff --git a/dist/index.js b/dist/index.js
index f88a93b..c45100f 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1823,7 +1823,8 @@ function getInputs() {
         result.persistCredentials =
             (core.getInput('persist-credentials') || 'false').toUpperCase() === 'TRUE';
         // Workflow organization ID
-        result.workflowOrganizationId = yield workflowContextHelper.getOrganizationId();
+        result.workflowOrganizationId =
+            yield workflowContextHelper.getOrganizationId();
         // Set safe.directory in git global config.
         result.setSafeDirectory =
             (core.getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE';
@@ -2535,8 +2536,7 @@ function getOrganizationId() {
             return id;
         }
         catch (err) {
-            core.debug(`Unable to load organization ID from GITHUB_EVENT_PATH: ${err
-                .message || err}`);
+            core.debug(`Unable to load organization ID from GITHUB_EVENT_PATH: ${err.message || err}`);
         }
     });
 }
diff --git a/src/fs-helper.ts b/src/fs-helper.ts
index 3741d35..00ad941 100644
--- a/src/fs-helper.ts
+++ b/src/fs-helper.ts
@@ -18,8 +18,9 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
     }
 
     throw new Error(
-      `Encountered an error when checking whether path '${path}' exists: ${(error as any)
-        ?.message ?? error}`
+      `Encountered an error when checking whether path '${path}' exists: ${
+        (error as any)?.message ?? error
+      }`
     )
   }
 
@@ -45,8 +46,9 @@ export function existsSync(path: string): boolean {
     }
 
     throw new Error(
-      `Encountered an error when checking whether path '${path}' exists: ${(error as any)
-        ?.message ?? error}`
+      `Encountered an error when checking whether path '${path}' exists: ${
+        (error as any)?.message ?? error
+      }`
     )
   }
 
@@ -67,8 +69,9 @@ export function fileExistsSync(path: string): boolean {
     }
 
     throw new Error(
-      `Encountered an error when checking whether path '${path}' exists: ${(error as any)
-        ?.message ?? error}`
+      `Encountered an error when checking whether path '${path}' exists: ${
+        (error as any)?.message ?? error
+      }`
     )
   }
 
diff --git a/src/git-auth-helper.ts b/src/git-auth-helper.ts
index b408d0f..126e8e5 100644
--- a/src/git-auth-helper.ts
+++ b/src/git-auth-helper.ts
@@ -49,7 +49,7 @@ class GitAuthHelper {
     gitSourceSettings: IGitSourceSettings | undefined
   ) {
     this.git = gitCommandManager
-    this.settings = gitSourceSettings || (({} as unknown) as IGitSourceSettings)
+    this.settings = gitSourceSettings || ({} as unknown as IGitSourceSettings)
 
     // Token auth header
     const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl)
diff --git a/src/input-helper.ts b/src/input-helper.ts
index e230a55..059232f 100644
--- a/src/input-helper.ts
+++ b/src/input-helper.ts
@@ -6,7 +6,7 @@ import * as workflowContextHelper from './workflow-context-helper'
 import {IGitSourceSettings} from './git-source-settings'
 
 export async function getInputs(): Promise<IGitSourceSettings> {
-  const result = ({} as unknown) as IGitSourceSettings
+  const result = {} as unknown as IGitSourceSettings
 
   // GitHub workspace
   let githubWorkspacePath = process.env['GITHUB_WORKSPACE']
@@ -150,7 +150,8 @@ export async function getInputs(): Promise<IGitSourceSettings> {
     (core.getInput('persist-credentials') || 'false').toUpperCase() === 'TRUE'
 
   // Workflow organization ID
-  result.workflowOrganizationId = await workflowContextHelper.getOrganizationId()
+  result.workflowOrganizationId =
+    await workflowContextHelper.getOrganizationId()
 
   // Set safe.directory in git global config.
   result.setSafeDirectory =
diff --git a/src/ref-helper.ts b/src/ref-helper.ts
index 1c25049..047e906 100644
--- a/src/ref-helper.ts
+++ b/src/ref-helper.ts
@@ -23,7 +23,7 @@ export async function getCheckoutInfo(
     throw new Error('Args ref and commit cannot both be empty')
   }
 
-  const result = ({} as unknown) as ICheckoutInfo
+  const result = {} as unknown as ICheckoutInfo
   const upperRef = (ref || '').toUpperCase()
 
   // SHA only
diff --git a/src/workflow-context-helper.ts b/src/workflow-context-helper.ts
index c7d7918..5b342e6 100644
--- a/src/workflow-context-helper.ts
+++ b/src/workflow-context-helper.ts
@@ -23,8 +23,9 @@ export async function getOrganizationId(): Promise<number | undefined> {
     return id as number
   } catch (err) {
     core.debug(
-      `Unable to load organization ID from GITHUB_EVENT_PATH: ${(err as any)
-        .message || err}`
+      `Unable to load organization ID from GITHUB_EVENT_PATH: ${
+        (err as any).message || err
+      }`
     )
   }
 }