Merge pull request #1344 from k-kbk/add-exception-handling
Some checks failed
test / test (push) Failing after 0s
validate / prepare (push) Failing after 0s
validate / validate (push) Has been skipped
e2e / build (AWS ECR Public, AWS_SECRET_ACCESS_KEY, public.ecr.aws, public.ecr.aws/q3b5f1u4/test-docker-action, remote, AWS_ACCESS_KEY_ID) (push) Failing after 0s
e2e / build (GitHub, GHCR_PAT, ghcr.io, ghcr.io/docker-ghactiontest/test, remote, GHCR_USERNAME) (push) Failing after 0s
e2e / build (AWS ECR, AWS_SECRET_ACCESS_KEY, 175142243308.dkr.ecr.us-east-2.amazonaws.com, 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action, remote, AWS_ACCESS_KEY_ID) (push) Failing after 0s
e2e / build (Artifactory, ARTIFACTORY_TOKEN, infradock.jfrog.io, infradock.jfrog.io/test-ghaction/build-push-action, remote, ARTIFACTORY_USERNAME) (push) Failing after 0s
e2e / build (Azure Container Registry, AZURE_CLIENT_SECRET, officialgithubactions.azurecr.io, officialgithubactions.azurecr.io/test-docker-action, remote, AZURE_CLIENT_ID) (push) Failing after 0s
e2e / build (Docker Hub, DOCKERHUB_TOKEN, , ghactionstest/ghactionstest, remote, DOCKERHUB_USERNAME) (push) Failing after 0s
e2e / build (GitLab, GITLAB_TOKEN, registry.gitlab.com, registry.gitlab.com/test1716/test, remote, GITLAB_USERNAME) (push) Failing after 0s
e2e / build (Google Container Registry, GCR_JSON_KEY, gcr.io, gcr.io/sandbox-298914/test-docker-action, remote, GCR_USERNAME) (push) Failing after 0s
e2e / build (Quay, QUAY_TOKEN, quay.io, quay.io/docker_build_team/ghactiontest, remote, QUAY_USERNAME) (push) Failing after 0s
e2e / build (distribution, Distribution, local) (push) Failing after 0s
e2e / build (Google Artifact Registry, GAR_JSON_KEY, us-east4-docker.pkg.dev, us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action, remote, GAR_USERNAME) (push) Failing after 0s
e2e / build (harbor, Harbor, local) (push) Failing after 0s
e2e / build (nexus, Nexus, local) (push) Failing after 0s

refactor: add missing 'new' and exception handling
This commit is contained in:
CrazyMax 2025-04-07 14:46:26 +02:00 committed by GitHub
commit 66147ca503
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 6 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -108,9 +108,9 @@ actionsToolkit.run(
if (inputs.call && inputs.call === 'check' && res.stdout.length > 0) {
// checks warnings are printed to stdout: https://github.com/docker/buildx/pull/2647
// take the first line with the message summaryzing the warnings
err = Error(res.stdout.split('\n')[0]?.trim());
err = new Error(res.stdout.split('\n')[0]?.trim());
} else if (res.stderr.length > 0) {
err = Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
err = new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
}
}
});
@ -225,7 +225,11 @@ actionsToolkit.run(
}
if (stateHelper.tmpDir.length > 0) {
await core.group(`Removing temp folder ${stateHelper.tmpDir}`, async () => {
fs.rmSync(stateHelper.tmpDir, {recursive: true});
try {
fs.rmSync(stateHelper.tmpDir, {recursive: true});
} catch (e) {
core.warning(`Failed to remove temp folder ${stateHelper.tmpDir}`);
}
});
}
}
@ -285,7 +289,7 @@ function buildRecordRetentionDays(): number | undefined {
if (val) {
const res = parseInt(val);
if (isNaN(res)) {
throw Error(`Invalid build record retention days: ${val}`);
throw new Error(`Invalid build record retention days: ${val}`);
}
return res;
}