From a92044f9743452e781791720ca7ef644169d115d Mon Sep 17 00:00:00 2001 From: chitran96 Date: Thu, 15 Jun 2023 18:05:49 +0700 Subject: [PATCH 1/2] Support Github Enterprise --- action.yml | 5 +++++ src/entrypoint | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b98e32a..8aca4c9 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,11 @@ description: > Publish diff coverage report as PR comment, and create a coverage badge to display on the readme. inputs: + GITHUB_URL: + description: > + A Github base url, api.github.com by default but can be different in GitHub Enterprise + default: "https://api.github.com" + required: false GITHUB_TOKEN: description: > A GitHub token to write comments and write the badge to the wiki diff --git a/src/entrypoint b/src/entrypoint index 4a9b373..71edb73 100755 --- a/src/entrypoint +++ b/src/entrypoint @@ -56,6 +56,7 @@ class Config: GITHUB_BASE_REF: str GITHUB_TOKEN: str + GITHUB_BASE_URL: str GITHUB_REPOSITORY: str GITHUB_REF: str BADGE_FILENAME: str = "coverage-comment-badge.json" @@ -117,7 +118,7 @@ class Config: def get_api(config: Config) -> github.Github: - return github.Github(config.GITHUB_TOKEN) + return github.Github(config.GITHUB_TOKEN, config.GITHUB_BASE_URL) def get_coverage_info(config: Config) -> dict: From baa0b3c0d2c1d58673d1f62802fe1c4bdf23a165 Mon Sep 17 00:00:00 2001 From: chitran96 Date: Thu, 15 Jun 2023 19:32:54 +0700 Subject: [PATCH 2/2] use GITHUB_API_URL instead --- action.yml | 5 ----- src/entrypoint | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 8aca4c9..b98e32a 100644 --- a/action.yml +++ b/action.yml @@ -6,11 +6,6 @@ description: > Publish diff coverage report as PR comment, and create a coverage badge to display on the readme. inputs: - GITHUB_URL: - description: > - A Github base url, api.github.com by default but can be different in GitHub Enterprise - default: "https://api.github.com" - required: false GITHUB_TOKEN: description: > A GitHub token to write comments and write the badge to the wiki diff --git a/src/entrypoint b/src/entrypoint index 71edb73..9a6dc2e 100755 --- a/src/entrypoint +++ b/src/entrypoint @@ -56,7 +56,7 @@ class Config: GITHUB_BASE_REF: str GITHUB_TOKEN: str - GITHUB_BASE_URL: str + GITHUB_API_URL: str GITHUB_REPOSITORY: str GITHUB_REF: str BADGE_FILENAME: str = "coverage-comment-badge.json" @@ -118,7 +118,7 @@ class Config: def get_api(config: Config) -> github.Github: - return github.Github(config.GITHUB_TOKEN, config.GITHUB_BASE_URL) + return github.Github(config.GITHUB_TOKEN, config.GITHUB_API_URL) def get_coverage_info(config: Config) -> dict: