Skip to content

Commit

Permalink
Path
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese committed Oct 31, 2023
1 parent a929a91 commit fd9703f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (owner === "false") owner = ownerName;

const push_to_org = core.getInput("org") !== "false";

function get_() {
function path_() {

if (push_to_org) return "/orgs/" + owner;
if (repository.includes("/")) return "/repos/" + repository;
Expand Down Expand Up @@ -47,8 +47,7 @@ function increment(string) {

const createVariable = (data) => {

let url = "POST ";
url += get_();
let url = "POST " + path_();
url += "/actions/variables";

return octokit.request(url, {
Expand All @@ -61,8 +60,7 @@ const createVariable = (data) => {

const setVariable = (data) => {

let url = "PATCH ";
url += get_();
let url = "PATCH " + path_();
url += "/actions/variables/" + name;

return octokit.request(url, {
Expand All @@ -75,8 +73,7 @@ const setVariable = (data) => {

const getVariable = (varname) => {

let url = "GET ";
url += get_();
let url = "GET " + path_();
url += "/actions/variables/" + varname;

return octokit.request(url, {
Expand Down Expand Up @@ -127,7 +124,7 @@ const bootstrap = async () => {
}

} catch (e) {
core.setFailed(get_() + ": " + e.message);
core.setFailed(path_() + ": " + e.message);
console.error(e);
}
};
Expand Down

0 comments on commit fd9703f

Please sign in to comment.