Skip to content

Commit

Permalink
move request.defaults() into entry files
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Aug 29, 2023
1 parent d7c9c70 commit c209b0b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
4 changes: 0 additions & 4 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import core from "@actions/core";
import { createAppAuth } from "@octokit/auth-app";
import { request } from "@octokit/request";

request.defaults({
baseUrl: process.env["GITHUB_API_URL"],
});

/**
* @param {string} appId
* @param {string} privateKey
Expand Down
4 changes: 0 additions & 4 deletions lib/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import core from "@actions/core";
import { request } from "@octokit/request";

request.defaults({
baseUrl: process.env["GITHUB_API_URL"],
});

/**
* @param {core} core
* @param {request} request
Expand Down
19 changes: 13 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ const privateKey = core.getInput("private_key");

const repository = process.env.GITHUB_REPOSITORY;

main(appId, privateKey, repository, core, createAppAuth, request).catch(
(error) => {
console.error(error);
core.setFailed(error.message);
}
);
main(
appId,
privateKey,
repository,
core,
createAppAuth,
request.defaults({
baseUrl: process.env["GITHUB_API_URL"],
})
).catch((error) => {
console.error(error);
core.setFailed(error.message);
});
15 changes: 9 additions & 6 deletions post.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import { request } from "@octokit/request";

import { post } from "./lib/post.js";

post(core, request).catch(
(error) => {
console.error(error);
core.setFailed(error.message);
}
);
post(
core,
request.defaults({
baseUrl: process.env["GITHUB_API_URL"],
})
).catch((error) => {
console.error(error);
core.setFailed(error.message);
});

0 comments on commit c209b0b

Please sign in to comment.