From 6397b31afbf2189a51000525e615c4adf2c51b4a Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Thu, 24 Nov 2022 13:53:58 +0900 Subject: [PATCH] fix: add check for missing token input --- dist/index.js | 3 +++ src/create-pull-request.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dist/index.js b/dist/index.js index aff221f87..01dfa96ba 100644 --- a/dist/index.js +++ b/dist/index.js @@ -311,6 +311,9 @@ function createPullRequest(inputs) { return __awaiter(this, void 0, void 0, function* () { let gitAuthHelper; try { + if (!inputs.token) { + throw new Error(`Input 'token' not supplied. Unable to continue.`); + } // Get the repository path const repoPath = utils.getRepoPath(inputs.path); // Create a git command manager diff --git a/src/create-pull-request.ts b/src/create-pull-request.ts index 1e42c1f5a..3fa3ec218 100644 --- a/src/create-pull-request.ts +++ b/src/create-pull-request.ts @@ -35,6 +35,10 @@ export interface Inputs { export async function createPullRequest(inputs: Inputs): Promise { let gitAuthHelper try { + if (!inputs.token) { + throw new Error(`Input 'token' not supplied. Unable to continue.`) + } + // Get the repository path const repoPath = utils.getRepoPath(inputs.path) // Create a git command manager