Skip to content

Commit

Permalink
🐛 Fix an issue where base_url was not being correctly used.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwir3 committed Jun 26, 2021
1 parent 7d69317 commit 41102cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ghp-release-cleaner",
"version": "1.0.1",
"version": "1.0.2",
"main": "index.js",
"scripts": {
"start": "node index.js"
Expand Down

0 comments on commit 41102cd

Please sign in to comment.