From 00489e61066e21b9a88d17d78a14a022b6b501fd Mon Sep 17 00:00:00 2001 From: "trop[bot]" Date: Thu, 18 Oct 2018 20:27:53 -0700 Subject: [PATCH] fix: make release-artifact-cleanup executable (backport: 3-0-x) (#15272) * fix: make release-artifact-cleanup executable * fix misc issues in cleanup script --- script/release-artifact-cleanup.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 script/release-artifact-cleanup.js diff --git a/script/release-artifact-cleanup.js b/script/release-artifact-cleanup.js old mode 100644 new mode 100755 index d15a864dcbb..99646c76184 --- a/script/release-artifact-cleanup.js +++ b/script/release-artifact-cleanup.js @@ -3,7 +3,7 @@ if (!process.env.CI) require('dotenv-safe').load() require('colors') const args = require('minimist')(process.argv.slice(2), { - boolean: ['tag'] + string: ['tag'] }) const { execSync } = require('child_process') const { GitProcess } = require('dugite') @@ -20,7 +20,7 @@ github.authenticate({ }) function getLastBumpCommit (tag) { - const data = execSync(`git log -n1 --grep "Bump ${tag}" --format="format:{hash: %H, message: '%s'}"`) + const data = execSync(`git log -n1 --grep "Bump ${tag}" --format='format:{"hash": "%H", "message": "%s"}'`).toString() return JSON.parse(data) } @@ -90,9 +90,9 @@ async function deleteTag (tag, targetRepo) { async function cleanReleaseArtifacts () { const tag = args.tag - const lastBumpCommit = getLastBumpCommit().message + const isNightly = args.tag.includes('nightly') - if (lastBumpCommit.indexOf('nightly' > 0)) { + if (isNightly) { await deleteDraft(tag, 'nightlies') await deleteTag(tag, 'nightlies') } else {