From 822eb5f6321f7631d440856325b36952a8652111 Mon Sep 17 00:00:00 2001 From: Trent Jones Date: Sat, 29 Feb 2020 14:00:06 -0600 Subject: [PATCH] ci test --- dist/index.js | 7 +++++-- src/delete.ts | 8 +++++++- src/input.ts | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 7cbe83e..81e4f01 100644 --- a/dist/index.js +++ b/dist/index.js @@ -13925,7 +13925,7 @@ class Input { return !!(this.owner && this.repo && this.packageName && - this.numOldVersionsToDelete != null && + this.numOldVersionsToDelete > 0 && this.token); } } @@ -15768,10 +15768,13 @@ function getVersionIds(input) { } exports.getVersionIds = getVersionIds; function deleteVersions(input) { - console.log(`input: ${JSON.stringify(input)}`); if (!input.token) { return rxjs_1.throwError('No token found'); } + if (input.numOldVersionsToDelete <= 0) { + console.log('Number of old versions to delete input is 0 or less, no versions will be deleted'); + return rxjs_1.of(true); + } return getVersionIds(input).pipe(operators_1.concatMap(ids => version_1.deletePackageVersions(ids, input.token))); } exports.deleteVersions = deleteVersions; diff --git a/src/delete.ts b/src/delete.ts index b1b71cf..3fbbb02 100644 --- a/src/delete.ts +++ b/src/delete.ts @@ -24,11 +24,17 @@ export function getVersionIds(input: Input): Observable { } export function deleteVersions(input: Input): Observable { - console.log(`input: ${JSON.stringify(input)}`) if (!input.token) { return throwError('No token found') } + if (input.numOldVersionsToDelete <= 0) { + console.log( + 'Number of old versions to delete input is 0 or less, no versions will be deleted' + ) + return of(true) + } + return getVersionIds(input).pipe( concatMap(ids => deletePackageVersions(ids, input.token)) ) diff --git a/src/input.ts b/src/input.ts index cf4ae51..ddbf683 100644 --- a/src/input.ts +++ b/src/input.ts @@ -40,7 +40,7 @@ export class Input { this.owner && this.repo && this.packageName && - this.numOldVersionsToDelete != null && + this.numOldVersionsToDelete > 0 && this.token ) }