Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fs-helper.ts15
-rw-r--r--src/git-auth-helper.ts6
-rw-r--r--src/git-directory-helper.ts4
-rw-r--r--src/github-api-helper.ts5
-rw-r--r--src/main.ts4
-rw-r--r--src/misc/generate-docs.ts8
-rw-r--r--src/ref-helper.ts4
-rw-r--r--src/retry-helper.ts2
8 files changed, 29 insertions, 19 deletions
diff --git a/src/fs-helper.ts b/src/fs-helper.ts
index c443404..3741d35 100644
--- a/src/fs-helper.ts
+++ b/src/fs-helper.ts
@@ -9,7 +9,7 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
try {
stats = fs.statSync(path)
} catch (error) {
- if (error.code === 'ENOENT') {
+ if ((error as any)?.code === 'ENOENT') {
if (!required) {
return false
}
@@ -18,7 +18,8 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
}
throw new Error(
- `Encountered an error when checking whether path '${path}' exists: ${error.message}`
+ `Encountered an error when checking whether path '${path}' exists: ${(error as any)
+ ?.message ?? error}`
)
}
@@ -39,12 +40,13 @@ export function existsSync(path: string): boolean {
try {
fs.statSync(path)
} catch (error) {
- if (error.code === 'ENOENT') {
+ if ((error as any)?.code === 'ENOENT') {
return false
}
throw new Error(
- `Encountered an error when checking whether path '${path}' exists: ${error.message}`
+ `Encountered an error when checking whether path '${path}' exists: ${(error as any)
+ ?.message ?? error}`
)
}
@@ -60,12 +62,13 @@ export function fileExistsSync(path: string): boolean {
try {
stats = fs.statSync(path)
} catch (error) {
- if (error.code === 'ENOENT') {
+ if ((error as any)?.code === 'ENOENT') {
return false
}
throw new Error(
- `Encountered an error when checking whether path '${path}' exists: ${error.message}`
+ `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 291d83b..af400ab 100644
--- a/src/git-auth-helper.ts
+++ b/src/git-auth-helper.ts
@@ -94,7 +94,7 @@ class GitAuthHelper {
await fs.promises.stat(gitConfigPath)
configExists = true
} catch (err) {
- if (err.code !== 'ENOENT') {
+ if ((err as any)?.code !== 'ENOENT') {
throw err
}
}
@@ -213,7 +213,7 @@ class GitAuthHelper {
await fs.promises.readFile(userKnownHostsPath)
).toString()
} catch (err) {
- if (err.code !== 'ENOENT') {
+ if ((err as any)?.code !== 'ENOENT') {
throw err
}
}
@@ -302,7 +302,7 @@ class GitAuthHelper {
try {
await io.rmRF(keyPath)
} catch (err) {
- core.debug(err.message)
+ core.debug(`${(err as any)?.message ?? err}`)
core.warning(`Failed to remove SSH key '${keyPath}'`)
}
}
diff --git a/src/git-directory-helper.ts b/src/git-directory-helper.ts
index e792190..2979e97 100644
--- a/src/git-directory-helper.ts
+++ b/src/git-directory-helper.ts
@@ -39,7 +39,9 @@ export async function prepareExistingDirectory(
try {
await io.rmRF(lockPath)
} catch (error) {
- core.debug(`Unable to delete '${lockPath}'. ${error.message}`)
+ core.debug(
+ `Unable to delete '${lockPath}'. ${(error as any)?.message ?? error}`
+ )
}
}
diff --git a/src/github-api-helper.ts b/src/github-api-helper.ts
index cadd13b..45b979a 100644
--- a/src/github-api-helper.ts
+++ b/src/github-api-helper.ts
@@ -92,7 +92,10 @@ export async function getDefaultBranch(
assert.ok(result, 'default_branch cannot be empty')
} catch (err) {
// Handle .wiki repo
- if (err['status'] === 404 && repo.toUpperCase().endsWith('.WIKI')) {
+ if (
+ (err as any)?.status === 404 &&
+ repo.toUpperCase().endsWith('.WIKI')
+ ) {
result = 'master'
}
// Otherwise error
diff --git a/src/main.ts b/src/main.ts
index 4702fe0..07a7ce3 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -24,7 +24,7 @@ async function run(): Promise<void> {
coreCommand.issueCommand('remove-matcher', {owner: 'checkout-git'}, '')
}
} catch (error) {
- core.setFailed(error.message)
+ core.setFailed(`${(error as any)?.message ?? error}`)
}
}
@@ -32,7 +32,7 @@ async function cleanup(): Promise<void> {
try {
await gitSourceProvider.cleanup(stateHelper.RepositoryPath)
} catch (error) {
- core.warning(error.message)
+ core.warning(`${(error as any)?.message ?? error}`)
}
}
diff --git a/src/misc/generate-docs.ts b/src/misc/generate-docs.ts
index defda5a..a1c845d 100644
--- a/src/misc/generate-docs.ts
+++ b/src/misc/generate-docs.ts
@@ -10,10 +10,10 @@ import * as yaml from 'js-yaml'
function updateUsage(
actionReference: string,
- actionYamlPath: string = 'action.yml',
- readmePath: string = 'README.md',
- startToken: string = '<!-- start usage -->',
- endToken: string = '<!-- end usage -->'
+ actionYamlPath = 'action.yml',
+ readmePath = 'README.md',
+ startToken = '<!-- start usage -->',
+ endToken = '<!-- end usage -->'
): void {
if (!actionReference) {
throw new Error('Parameter actionReference must not be empty')
diff --git a/src/ref-helper.ts b/src/ref-helper.ts
index 381fa60..209f49d 100644
--- a/src/ref-helper.ts
+++ b/src/ref-helper.ts
@@ -253,7 +253,9 @@ export async function checkCommitInfo(
await octokit.repos.get({owner: repositoryOwner, repo: repositoryName})
}
} catch (err) {
- core.debug(`Error when validating commit info: ${err.stack}`)
+ core.debug(
+ `Error when validating commit info: ${(err as any)?.stack ?? err}`
+ )
}
}
diff --git a/src/retry-helper.ts b/src/retry-helper.ts
index bbc20a1..323e75d 100644
--- a/src/retry-helper.ts
+++ b/src/retry-helper.ts
@@ -29,7 +29,7 @@ export class RetryHelper {
try {
return await action()
} catch (err) {
- core.info(err.message)
+ core.info((err as any)?.message)
}
// Sleep