python-coverage-comment-action
python-coverage-comment-action copied to clipboard
GITHUB_BASE_URL is not passed into dockerfile
in action.yml the GITHUB_BASE_URL is missing from the list environment variables that are set in the docker.
For me this action does not work in GitHub enterprise environment. I believe this is the reason.
With my change (see fork) the GITHUB_BASE_URL seems to be passed correctly to the Docker. An issues remains. I get this message: ... Notice: Starting action Notice: HTTP Request: GET < GITHUB_BASE_URL >/repos/< organization_name >/< repo-name > "HTTP/1.1 302 Found" ...
it tries to get something at github_base_url/repos/organization_name/repo_name, however my code is at github_base_url/organization_name/repo_name. Somewhere in the code this repos folder is added. I was not able to find that.
Can you point me in the right direction?
Let's merge you PR and, yeah, find this bug :)
Is it possible that you're putting your GITHUB_BASE_URL where it should be the base of the API, which should be (if I understand correctly) https://<hostname>/api/v3/ ?
If so, do you want to make a PR making this explicit in the doc ?
I've updated the PR to include more info about the format of the GITHUB_BASE_URL.
After the change, the login is successful, however now it complains about the wrong access rights.
Notice: Generating comment for PR Error: Critical error. This error possibly occurred because the permissions of the workflow are set incorrectly. You can see the correct setting of permissions here: https://github.com/py-cov-action/python-coverage-comment-action#basic-usage Otherwise please look for open issues or open one in https://github.com/py-cov-action/python-coverage-comment-action/
As experiment, I set my permissions as follows:
permissions:
# Gives the 'python-coverage-comment-action' action the necessary
# permissions for publishing new comments in pull requests.
pull-requests: write
# Gives the 'python-coverage-comment-action' action the necessary
# permissions for pushing data to the python-coverage-comment-action
# branch, and for editing existing comments (to avoid publishing
# multiple comments in the same PR)
contents: write
#FIXME: set all permissions to write --> !!just for testing purposes!! <--
actions: write
checks: write
deployments: write
issues: write
packages: write
repository-projects: write
security-events: write
statuses: write
I also swapped the ${{ github.token }} with a PAT with full access. In both cases I get the same message.
Do you have any idea what might be the reason for this?
Diving a bit deeping by enabling the debug-output, I also see the message:
##[debug]receive_response_body.started request=<Request [b'GET']> ##[debug]receive_response_body.complete ##[debug]response_closed.started ##[debug]response_closed.complete Notice: Generating comment for PR ##[debug]Command failed: args=('git', 'fetch', 'origin', 'main', '--depth=1000') path=PosixPath('.') kwargs={ ... cut ... } exc.stderr="fatal: could not read Username for '
': No such device or address\n" exc.returncode=128
Do you have any suggestions of what I can try?
Sorry, I'm a bit lost on whether this still is an issue, especially since https://github.com/py-cov-action/python-coverage-comment-action/pull/589 was merged ?
I don't have access to GitHub Enterprise, so it's not easy to see if something's broken 😅
Sorry, I'm a bit lost on whether this still is an issue, especially since #589 was merged ?
I don't have access to GitHub Enterprise, so it's not easy to see if something's broken 😅
I will check it later this week.
(Closing for now, feel free to reopen if relevant, thanks)
@ewjoachim I may be getting a similar issue. I use a github enterprise, and used GITHUB_BASE_URL: https://my.private.git.enterprise.com/api/v3/. The GITHUB_TOKEN is a PAT generated at my github entrprise instance, not github.com
Run actions-ext/[email protected]
with:
GITHUB_BASE_URL: https://my.private.git.enterprise.com/api/v3/
GITHUB_TOKEN: ***
MINIMUM_GREEN: 100
MINIMUM_ORANGE: 70
SUBPROJECT_ID: component_onnx-python_3.12-torch_2.7.1-onnxruntime_1.20.1
COVERAGE_DATA_BRANCH: python-coverage-comment-action-data
COVERAGE_PATH: .
COMMENT_ARTIFACT_NAME: python-coverage-comment-action
COMMENT_FILENAME: python-coverage-comment-action.txt
MAX_FILES_IN_COMMENT: 25
MERGE_COVERAGE_FILES: false
ANNOTATE_MISSING_LINES: false
ANNOTATION_TYPE: warning
USE_GH_PAGES_HTML_URL: false
VERBOSE: false
env:
HARDWARE_TYPE: rocm-6.2.4
pythonLocation: /scratch/actions-runner-8/_work/_tool/Python/3.12.11/x64
PKG_CONFIG_PATH: /scratch/actions-runner-8/_work/_tool/Python/3.12.11/x64/lib/pkgconfig
Python_ROOT_DIR: /scratch/actions-runner-8/_work/_tool/Python/3.12.11/x64
Python2_ROOT_DIR: /scratch/actions-runner-8/_work/_tool/Python/3.12.11/x64
Python3_ROOT_DIR: /scratch/actions-runner-8/_work/_tool/Python/3.12.11/x64
LD_LIBRARY_PATH: /scratch/actions-runner-8/_work/_tool/Python/3.12.11/x64/lib
/usr/bin/docker run --name b727b9e4f0d5c8fe4f2ea2359906fbe4e645_2f92db --label 84b727 --workdir /github/workspace --rm -e "HARDWARE_TYPE" -e "pythonLocation" -e "PKG_CONFIG_PATH" -e "Python_ROOT_DIR" -e "Python2_ROOT_DIR" -e "Python3_ROOT_DIR" -e "LD_LIBRARY_PATH" -e "INPUT_GITHUB_BASE_URL" -e "INPUT_GITHUB_TOKEN" -e "INPUT_MINIMUM_GREEN" -e "INPUT_MINIMUM_ORANGE" -e "INPUT_SUBPROJECT_ID" -e "INPUT_GITHUB_PR_RUN_ID" -e "INPUT_COMMENT_TEMPLATE" -e "INPUT_COVERAGE_DATA_BRANCH" -e "INPUT_COVERAGE_PATH" -e "INPUT_COMMENT_ARTIFACT_NAME" -e "INPUT_COMMENT_FILENAME" -e "INPUT_MAX_FILES_IN_COMMENT" -e "INPUT_MERGE_COVERAGE_FILES" -e "INPUT_ANNOTATE_MISSING_LINES" -e "INPUT_ANNOTATION_TYPE" -e "INPUT_USE_GH_PAGES_HTML_URL" -e "INPUT_VERBOSE" -e "GITHUB_BASE_URL" -e "GITHUB_TOKEN" -e "GITHUB_PR_RUN_ID" -e "COMMENT_TEMPLATE" -e "COVERAGE_DATA_BRANCH" -e "COVERAGE_PATH" -e "COMMENT_ARTIFACT_NAME" -e "COMMENT_FILENAME" -e "SUBPROJECT_ID" -e "MINIMUM_GREEN" -e "MINIMUM_ORANGE" -e "MERGE_COVERAGE_FILES" -e "ANNOTATE_MISSING_LINES" -e "ANNOTATION_TYPE" -e "VERBOSE" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_EVENT_PATH" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "GITHUB_ACTION" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/scratch/actions-runner-8/_work/_temp/_github_home":"/github/home" -v "/scratch/actions-runner-8/_work/_temp/_github_workflow":"/github/workflow" -v "/scratch/actions-runner-8/_work/_temp/_runner_file_commands":"/github/file_commands" -v "/scratch/actions-runner-8/_work/Quark/Quark":"/github/workspace" 84b727:b9e4f0d5c8fe4f2ea2359906fbe4e645
Unable to find image '84b727:b9e4f0d5c8fe4f2ea2359906fbe4e645' locally
docker: Error response from daemon: pull access denied for 84b727, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
I cloned the repo https://github.com/py-cov-action/python-coverage-comment-action-v3-example. After changing the GITHUB_BASE_URL, the CI.yaml workflow runs correctly.
I looks like the problem is resolved.
GITHUB_BASE_URL
what did you pass as GITHUB_BASE_URL? something like https://github.com or something like https://github.com/api/v3? did you set GITHUB_TOKEN too? did you use a token from the git enterprise or from github.com?
GITHUB_BASE_URL
what did you pass as
GITHUB_BASE_URL? something likehttps://github.comor something likehttps://github.com/api/v3? did you setGITHUB_TOKENtoo? did you use a token from the git enterprise or from github.com?
I'm running the action on GHE 3.16.8 and I'm using the GITHUB_BASE_URL with format https://github.mycompany.com/api/v3.
For me there was no need to set the GITHUB_TOKEN.
As experiment, I did the following:
- clone the repo https://github.com/py-cov-action/python-coverage-comment-action-v3-example and pushed it to a repo on my companies premise (https://github.mycompany.com)
- added the line
GITHUB_BASE_URL: https://github.mycompany.com/api/v3to theci.yamlandcoverage.yaml - pushed the changes to the repo
Just to be complete:
ci.yamlruns as expected (without problems).coverage.yamldoes not run as expected. It passes (green checkmark), however it raises the following error:
Notice: Artifact was not found, which is probably because it was probably already posted by a previous step.
Traceback (most recent call last):
File "/workdir/coverage_comment/github.py", line 92, in download_artifact
artifact = next(
^^^^^
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workdir/coverage_comment/main.py", line 349, in post_comment
comment = github.download_artifact(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workdir/coverage_comment/github.py", line 98, in download_artifact
raise NoArtifact(f"No artifact found with name {artifact_name} in run {run_id}")
coverage_comment.github.NoArtifact: No artifact found with name python-coverage-comment-action in run 322069
Notice: Ending action
@thiagocrepaldi The error that you get is different from mine. In your case the execution of the action goes wrong because it cannot pull the docker (no access for whatever reason). This ticket is about an issue that pops up in the application running in the docker. I expect your problem is not in the GITHUB_BASE_URL or in any other configuration items of the action.yaml file.