Skip to content

Use exit code 21 in GitHub action if working-directory is missing #594

@akaihola

Description

@akaihola

For error handling, it would be useful to have a unique exit code from the Darker GitHub action if the directory specified as working-directory doesn't exist.

Here's the current behavior:

Traceback (most recent call last):
  File "/home/runner/work/darker/darker/action/main.py", line 59, in <module>
    proc = run(  # nosec
  File "/usr/lib/python3.10/subprocess.py", line 503, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/_temp/non-existent-dir'
##[error]Process completed with exit code 1.

Darker itself uses an exit code of 2 if a file doesn't exist. For example 21 as a variation of that code could be used for the action.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions