py-cov-action / python-coverage-comment-action

Publish coverage report as PR comment, and create a coverage badge & dashboard to display on the Readme for Python projects, all inside GitHub without third party servers
https://github.com/marketplace/actions/python-coverage-comment
MIT License
84 stars 32 forks source link

action can not be used on an enterprise installation #498

Open asml-ropeeter opened 3 weeks ago

asml-ropeeter commented 3 weeks ago

As an enterprise user i want to have the API url not hardcoded so i can use this action in a different environment.

Problem: Action cannot be used in a enterprise install Cause: Hardcoded URL's Containment: None Solution: Use default github environment variables https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace

GITHUB_SERVER_URL GITHUB_API_URL

Example: https://github.com/py-cov-action/python-coverage-comment-action/blob/main/coverage_comment/main.py

    github_session = httpx.Client(
        base_url="https://api.github.com",
        follow_redirects=True,
        headers={"Authorization": f"token {config.GITHUB_TOKEN}"},
    )

Proposed: github_session = httpx.Client( base_url="{config.GITHUB_API_URL}", follow_redirects=True, headers={"Authorization": f"token {config.GITHUB_TOKEN}"}, )

Please investigate for more hardcoded URLs

ewjoachim commented 2 weeks ago

Hey :)

I have no way to test such a change, I don't have access to an deploy of GH enterprise. I'll be happy to merge a PR you'd provide if you can validate on your side that it works, but I'm not sure if I can be in a position to ensure that it doesn't break in the future, so it will likely not be official support, but best effort. If that's ok with you, then feel free to submit a PR, I'll gladly merge it. (or maybe someone else interested by the change would like to implement it)

asml-ropeeter commented 1 week ago

Hi, thanks for your fast response. Let me check if we can help you with the validation.