From 41102cd4a39b3521e1fc8db1e50f8b8a212fa45d Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Fri, 25 Jun 2021 22:41:00 -0500 Subject: [PATCH] :bug: Fix an issue where base_url was not being correctly used. --- index.js | 9 +++++---- package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 6681f95..8302279 100644 --- a/index.js +++ b/index.js @@ -4,10 +4,6 @@ const fetch = require('node-fetch'); const core = require('@actions/core'); const github = require('@actions/github'); -// Pull data from github -const base_url = "https://api.github.com"; -const accept_header = "application/vnd.github.v3+json"; - new Promise((resolve, reject) => { let org = core.getInput('org'); let auth_token = core.getInput('token'); @@ -68,7 +64,12 @@ function delete_packages(result_packages, org, package_name, auth_token) { } function send_request(path, method, body, auth_token) { + // Pull data from github + const base_url = "https://api.github.com"; + const accept_header = "application/vnd.github.v3+json"; + const url = new URL(path, base_url); + console.log(`Making request to: ${url}`); return fetch(url, { headers: { 'Accept': accept_header, diff --git a/package.json b/package.json index f0afacc..c255b67 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghp-release-cleaner", - "version": "1.0.1", + "version": "1.0.2", "main": "index.js", "scripts": { "start": "node index.js"