From 2403bbedac18dfbe2b06f20c021ba573e82fa829 Mon Sep 17 00:00:00 2001 From: Aiqiao Yan Date: Mon, 20 Apr 2020 13:44:37 -0400 Subject: [PATCH] Make sure ref is not null or empty --- dist/restore/index.js | 2 +- dist/save/index.js | 2 +- src/utils/actionUtils.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index 75c68a3..8acf822 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -3309,7 +3309,7 @@ exports.resolvePaths = resolvePaths; // Cache token authorized for all events that are tied to a ref // See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context function isValidEvent() { - return constants_1.RefKey in process.env; + return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]); } exports.isValidEvent = isValidEvent; function unlinkFile(path) { diff --git a/dist/save/index.js b/dist/save/index.js index a5087f6..549a813 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -3309,7 +3309,7 @@ exports.resolvePaths = resolvePaths; // Cache token authorized for all events that are tied to a ref // See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context function isValidEvent() { - return constants_1.RefKey in process.env; + return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]); } exports.isValidEvent = isValidEvent; function unlinkFile(path) { diff --git a/src/utils/actionUtils.ts b/src/utils/actionUtils.ts index 1a04492..50a5ef7 100644 --- a/src/utils/actionUtils.ts +++ b/src/utils/actionUtils.ts @@ -115,7 +115,7 @@ export async function resolvePaths(patterns: string[]): Promise { // Cache token authorized for all events that are tied to a ref // See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context export function isValidEvent(): boolean { - return RefKey in process.env; + return RefKey in process.env && Boolean(process.env[RefKey]); } export function unlinkFile(path: fs.PathLike): Promise {