From f2b27e3ec82072440e5cf13d164ea70ea4ea9c86 Mon Sep 17 00:00:00 2001 From: Giao Ho Date: Sat, 20 Jan 2024 17:02:20 +0700 Subject: [PATCH 1/3] Remove unuse code --- src/delete-artifact.ts | 2 -- src/io-helper.ts | 34 ---------------------------------- 2 files changed, 36 deletions(-) diff --git a/src/delete-artifact.ts b/src/delete-artifact.ts index d622f4b..06d6fb2 100644 --- a/src/delete-artifact.ts +++ b/src/delete-artifact.ts @@ -74,7 +74,6 @@ export interface DeleteResponse { await Promise.all(artifactsToDelete.map(async (value) => { try { await artifact.deleteArtifact(value.name, findOptions); - core.info(`Artifact ${value.name} was deleted`); result.artifacts[value.name] = { ...value, status: 'success' @@ -82,7 +81,6 @@ export interface DeleteResponse { result.deleted.count++; result.deleted.names.push(value.name); } catch (e) { - core.info(`Deleting artifact ${value.name} failed`); result.artifacts[value.name] = { ...value, status: 'fail' diff --git a/src/io-helper.ts b/src/io-helper.ts index 6fa84ce..df06a2c 100644 --- a/src/io-helper.ts +++ b/src/io-helper.ts @@ -1,8 +1,6 @@ import * as core from '@actions/core'; import {InputOptions} from '@actions/core'; import {Inputs, Outputs} from './constants'; -import {FindOptions, ListArtifactsOptions} from '@actions/artifact'; -import {context} from '@actions/github'; export class DeleteInputs { public owner?: string; @@ -23,38 +21,6 @@ export class DeleteInputs { public get deleteAll(): boolean { return this.artifactNames == null || this.artifactNames.length === 0; } - - public get findOptions(): FindOptions { - const options: ListArtifactsOptions & FindOptions = {}; - if (isNotBlank(this.runId) && isNotBlank(this.token)) { - options.findBy = { - token: this.token as string, - repositoryOwner: this.owner ?? context.repo.owner, - repositoryName: this.repo ?? context.repo.repo, - workflowRunId: this.runId as number - }; - } - if (this.latest != null) { - options.latest = this.latest; - } - return options; - } - - public get listOptions(): ListArtifactsOptions & FindOptions { - const options: ListArtifactsOptions & FindOptions = {}; - if (isNotBlank(this.runId) && isNotBlank(this.token)) { - options.findBy = { - token: this.token as string, - repositoryOwner: this.owner ?? context.repo.owner, - repositoryName: this.repo ?? context.repo.repo, - workflowRunId: this.runId as number - }; - } - if (this.latest != null) { - options.latest = this.latest; - } - return options; - } } export function isNotBlank(value: any): boolean { From de656c90a66b717757b5fd103ed2a08ff6c16a3b Mon Sep 17 00:00:00 2001 From: Giao Ho Date: Sat, 20 Jan 2024 17:03:01 +0700 Subject: [PATCH 2/3] Rebuild --- action/index.js | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/action/index.js b/action/index.js index a0418e3..d36cb18 100644 --- a/action/index.js +++ b/action/index.js @@ -120702,13 +120702,11 @@ const io_helper_1 = __nccwpck_require__(3262); yield Promise.all(artifactsToDelete.map((value) => __awaiter(this, void 0, void 0, function* () { try { yield artifact_1.default.deleteArtifact(value.name, findOptions); - core.info(`Artifact ${value.name} was deleted`); result.artifacts[value.name] = Object.assign(Object.assign({}, value), { status: 'success' }); result.deleted.count++; result.deleted.names.push(value.name); } catch (e) { - core.info(`Deleting artifact ${value.name} failed`); result.artifacts[value.name] = Object.assign(Object.assign({}, value), { status: 'fail' }); result.failed.count++; result.failed.names.push(value.name); @@ -120758,7 +120756,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.setOutputs = exports.getInputs = exports.getBooleanInput = exports.isNotBlank = exports.DeleteInputs = void 0; const core = __importStar(__nccwpck_require__(2186)); const constants_1 = __nccwpck_require__(9042); -const github_1 = __nccwpck_require__(5438); class DeleteInputs { constructor(artifactNames = []) { this.artifactNames = artifactNames; @@ -120766,38 +120763,6 @@ class DeleteInputs { get deleteAll() { return this.artifactNames == null || this.artifactNames.length === 0; } - get findOptions() { - var _a, _b; - const options = {}; - if (isNotBlank(this.runId) && isNotBlank(this.token)) { - options.findBy = { - token: this.token, - repositoryOwner: (_a = this.owner) !== null && _a !== void 0 ? _a : github_1.context.repo.owner, - repositoryName: (_b = this.repo) !== null && _b !== void 0 ? _b : github_1.context.repo.repo, - workflowRunId: this.runId - }; - } - if (this.latest != null) { - options.latest = this.latest; - } - return options; - } - get listOptions() { - var _a, _b; - const options = {}; - if (isNotBlank(this.runId) && isNotBlank(this.token)) { - options.findBy = { - token: this.token, - repositoryOwner: (_a = this.owner) !== null && _a !== void 0 ? _a : github_1.context.repo.owner, - repositoryName: (_b = this.repo) !== null && _b !== void 0 ? _b : github_1.context.repo.repo, - workflowRunId: this.runId - }; - } - if (this.latest != null) { - options.latest = this.latest; - } - return options; - } } exports.DeleteInputs = DeleteInputs; function isNotBlank(value) { From 3189247fd0d6584cd1599a1916ac6955cc15012f Mon Sep 17 00:00:00 2001 From: Giao Ho Date: Sat, 20 Jan 2024 17:04:39 +0700 Subject: [PATCH 3/3] Update version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b67cdc2..78adf3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "delete-artifact", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "delete-artifact", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "dependencies": { "@actions/artifact": "^2.1.0", diff --git a/package.json b/package.json index 34a3a6e..230d7a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "delete-artifact", - "version": "2.0.0", + "version": "2.0.1", "description": "Delete a build artifact that was previously uploaded in the workflow by the upload-artifact action", "scripts": { "build": "npm run clean && tsc --project tsconfig.json",