Skip to content

Version 3.33 raises errors in GitHub actions #554

@sblauth

Description

@sblauth

Hello,

I am having trouble upgrading to the current version of the action. The correspondig PR for my repo is: sblauth/cashocs#678

The error raised is the following:

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/
Traceback (most recent call last):
  File "/workdir/coverage_comment/subprocess.py", line 22, in run
    return subprocess.run(
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('git', 'diff', '--unified=0', 'FETCH_HEAD...HEAD')' returned non-zero exit status 128.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/workdir/coverage_comment/subprocess.py", line 65, in _git
    return run(
           ^^^^
  File "/workdir/coverage_comment/subprocess.py", line 36, in run
    raise SubProcessError("\n".join([exc.stderr, exc.stdout])) from exc
coverage_comment.subprocess.SubProcessError: fatal: FETCH_HEAD...HEAD: no merge base



The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/workdir/coverage_comment/main.py", line 46, in main
    exit_code = action(
                ^^^^^^^
  File "/workdir/coverage_comment/main.py", line 98, in action
    return process_pr(
           ^^^^^^^^^^^
  File "/workdir/coverage_comment/main.py", line 135, in process_pr
    added_lines = coverage_module.get_added_lines(git=git, base_ref=base_ref)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workdir/coverage_comment/coverage.py", line 296, in get_added_lines
    diff = git.diff("--unified=0", "FETCH_HEAD...HEAD")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workdir/coverage_comment/subprocess.py", line 73, in _git
    raise GitError from exc
coverage_comment.subprocess.GitError

It seems to be related to the changes in how the git diff is computed. With previous versions of the action, there have not been any problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions