Skip to content

Commit

Permalink
feat: add GitHub Enterprise Server (GHES) support (actions#36)
Browse files Browse the repository at this point in the history
This adds support for this action to be used in GitHub Enterprise
Server.

It sends request to the base url extracted from
[GITHUB_API_URL](https://docs.github.com/en/enterprise-server@3.10/actions/learn-github-actions/variables#default-environment-variables).

---------

Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
  • Loading branch information
7Hazard and gr2m authored Aug 29, 2023
1 parent 17cde8a commit ede6c15
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function post(core, request) {
const token = core.getState("token");

if (!token) return;

await request("DELETE /installation/token", {
headers: {
authorization: `token ${token}`,
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 ede6c15

Please sign in to comment.