Skip to content

Commit a200feb

Browse files
authored
Merge pull request #503 from daniel-anya/includes-support-for-github-enterprise
2 parents 6452d11 + 60d5d01 commit a200feb

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
dev-env-vars
55
.coverage*
66
__pycache__
7+
.idea/

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ jobs:
313313
with:
314314
GITHUB_TOKEN: ${{ github.token }}
315315

316+
# Change this in case you use GitHub Entreprise with a different API endpoint
317+
GITHUB_BASE_URL: https://api.github.com
318+
316319
# Only necessary in the "workflow_run" workflow.
317320
GITHUB_PR_RUN_ID: ${{ inputs.GITHUB_PR_RUN_ID }}
318321

@@ -594,6 +597,10 @@ source =
594597
This action is supposedly compatible with private repository. Just make sure
595598
to use the svg badge directly, and not the `shields.io` URL.
596599

600+
## Github Enterprise (GHE) Support
601+
602+
This action should be compatible with GitHub Enterprise. Just make sure to set the `GITHUB_BASE_URL` input to your GHE URL.
603+
597604
## Upgrading from v2 to v3
598605

599606
When upgrading, we change the location and format where the coverage

action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ description: >
66
Publish diff coverage report as PR comment, and create a coverage badge
77
to display on the readme.
88
inputs:
9+
GITHUB_BASE_URL:
10+
description: >
11+
The base URL for the GitHub API, typically used to specify custom endpoints
12+
for GitHub Enterprise Server (e.g., `https://github.mycompany.com/api/v3`).
13+
Defaults to `https://api.github.com` for GitHub.com.
14+
default: "https://api.github.com"
15+
required: false
916
GITHUB_TOKEN:
1017
description: >
1118
A GitHub token to write comments and write the badge & coverage data

coverage_comment/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def main():
3434
config = settings.Config.from_environ(environ=os.environ)
3535

3636
github_session = httpx.Client(
37-
base_url="https://api.github.com",
37+
base_url=config.GITHUB_BASE_URL,
3838
follow_redirects=True,
3939
headers={"Authorization": f"token {config.GITHUB_TOKEN}"},
4040
)

coverage_comment/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Config:
3737

3838
# A branch name, not a fully-formed ref. For example, `main`.
3939
GITHUB_BASE_REF: str
40+
GITHUB_BASE_URL: str = "https://api.github.com"
4041
GITHUB_TOKEN: str = dataclasses.field(repr=False)
4142
GITHUB_REPOSITORY: str
4243
# > The ref given is fully-formed, meaning that for branches the format is

0 commit comments

Comments
 (0)