Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
fix: Github Action handles endpoints ending in / (#249)
Browse files Browse the repository at this point in the history
StuartRucker authored Aug 17, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 12242d6 commit 78b0d7a
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions packages/action/dist/index.js
Original file line number Diff line number Diff line change
@@ -182,7 +182,7 @@ module.exports = require("https");
const fetch = __webpack_require__(492);
const fs = __webpack_require__(747);
const core = __webpack_require__(931);

const {resolve} = __webpack_require__(835);
/**
* main
*/
@@ -217,7 +217,7 @@ async function main () {
token: core.getInput('repo-token')
};

metaData.environment.matrix = JSON.stringify(metaData.environment.matrix, Object.keys(metaData.environment.matrix).sort()); // consistency
metaData.environment.matrix = JSON.stringify(metaData.environment.matrix, Object.keys(metaData.environment.matrix).sort()); // consistancy

metaData.environment.ref = metaData.environment.ref.replace('refs/', '');
metaData.environment.ref = metaData.environment.ref.replace('heads/', '');
@@ -232,7 +232,7 @@ async function main () {
const data = fs.readFileSync(
core.getInput('file-path'), 'utf8');
const sendMe = { type: fileType, data: data, metadata: metaData };
const endpoint = core.getInput('endpoint') + '/api/build/gh/v1';
const endpoint = resolve(core.getInput('endpoint'), '/api/build/gh/v1');
console.log('Beginning Upload of data...');
const outcome = await fetch(endpoint, {
method: 'POST',
@@ -248,7 +248,7 @@ async function main () {
throw 'Upload Failed';
} else if (outcomeAsJSON.message) {
console.log('Build Uploaded Successfully!');
console.log('Visit ' + core.getInput('endpoint') + '/org/' + process.env.GITHUB_REPOSITORY + ' to see uploaded data');
console.log('Visit ' + resolve(resolve(core.getInput('endpoint'),'/org/'), process.env.GITHUB_REPOSITORY) + ' to see uploaded data');
} else {
core.warning('Encountered unknown error, possibly involving server issues');
throw 'Unkown Error';
@@ -2194,4 +2194,4 @@ module.exports = eval("require")("encoding");

/***/ })

/******/ });
/******/ });
6 changes: 3 additions & 3 deletions packages/action/index.js
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
const fetch = require('node-fetch');
const fs = require('fs');
const core = require('@actions/core');

const {resolve} = require('url');
/**
* main
*/
@@ -65,7 +65,7 @@ async function main () {
const data = fs.readFileSync(
core.getInput('file-path'), 'utf8');
const sendMe = { type: fileType, data: data, metadata: metaData };
const endpoint = core.getInput('endpoint') + '/api/build/gh/v1';
const endpoint = resolve(core.getInput('endpoint'), '/api/build/gh/v1');
console.log('Beginning Upload of data...');
const outcome = await fetch(endpoint, {
method: 'POST',
@@ -81,7 +81,7 @@ async function main () {
throw 'Upload Failed';
} else if (outcomeAsJSON.message) {
console.log('Build Uploaded Successfully!');
console.log('Visit ' + core.getInput('endpoint') + '/org/' + process.env.GITHUB_REPOSITORY + ' to see uploaded data');
console.log('Visit ' + resolve(resolve(core.getInput('endpoint'),'/org/'), process.env.GITHUB_REPOSITORY) + ' to see uploaded data');
} else {
core.warning('Encountered unknown error, possibly involving server issues');
throw 'Unkown Error';

0 comments on commit 78b0d7a

Please sign in to comment.