After applying audit, the CLI offers the option to delete main. Since main has already been renamed at this point, it crashes in the CLI (even though other audits were completed successfully).
Failed output:
Branch 'main' is fully merged into 'dev' and is no longer needed.
Delete 'main'? [y/N]: y
Traceback (most recent call last):
File "/Users/jose.orjales/.local/bin/idea-gh", line 10, in <module>
sys.exit(cli())
^^^^^
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/click/core.py", line 1524, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/click/core.py", line 1445, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/click/core.py", line 1912, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/click/core.py", line 1308, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/click/core.py", line 877, in invoke
return callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/click/decorators.py", line 34, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/gds_idea_gh_kit/cli.py", line 112, in audit
_handle_stale_branches(fix_result, owner, repo, client)
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/gds_idea_gh_kit/cli.py", line 147, in _handle_stale_branches
client.delete_branch(owner, repo, stale.branch)
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/gds_idea_gh_kit/github_client.py", line 339, in delete_branch
self._request("DELETE", f"/repos/{owner}/{repo}/git/refs/heads/{branch}")
File "/Users/jose.orjales/.local/share/uv/tools/gds-idea-gh-kit/lib/python3.12/site-packages/gds_idea_gh_kit/github_client.py", line 119, in _request
raise GitHubClientError(f"GitHub API error {response.status_code} on {method} {path}: {body}")
gds_idea_gh_kit.github_client.GitHubClientError: GitHub API error 422 on DELETE /repos/co-cddo/gds-idea-app-reserve-radar/git/refs/heads/main: {"message":"Reference does not exist","documentation_url":"https://docs.github.com/rest/git/refs#delete-a-reference","status":"422"}
After applying audit, the CLI offers the option to delete main. Since main has already been renamed at this point, it crashes in the CLI (even though other audits were completed successfully).
Failed output: