github2gerrit 0.1.16__tar.gz → 0.1.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/PKG-INFO +1 -1
  2. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/core.py +75 -21
  3. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/.editorconfig +0 -0
  4. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/.gitignore +0 -0
  5. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/.gitlint +0 -0
  6. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/.markdownlint.yaml +0 -0
  7. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/.pre-commit-config.yaml +0 -0
  8. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/.readthedocs.yml +0 -0
  9. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/.yamllint +0 -0
  10. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/LICENSE +0 -0
  11. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/LICENSES/Apache-2.0.txt +0 -0
  12. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/README.md +0 -0
  13. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/REUSE.toml +0 -0
  14. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/REVISION_PLAN.md +0 -0
  15. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/action.yaml +0 -0
  16. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/docs/COMPOSITE_ACTION_TESTING.md +0 -0
  17. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/docs/github2gerrit_token_permissions_classic.png +0 -0
  18. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/pyproject.toml +0 -0
  19. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/sitecustomize.py +0 -0
  20. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/__init__.py +0 -0
  21. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/cli.py +0 -0
  22. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/commit_normalization.py +0 -0
  23. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/config.py +0 -0
  24. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/duplicate_detection.py +0 -0
  25. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/external_api.py +0 -0
  26. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/gerrit_query.py +0 -0
  27. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/gerrit_rest.py +0 -0
  28. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/gerrit_urls.py +0 -0
  29. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/github_api.py +0 -0
  30. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/gitutils.py +0 -0
  31. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/mapping_comment.py +0 -0
  32. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/models.py +0 -0
  33. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/orchestrator/__init__.py +0 -0
  34. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/orchestrator/reconciliation.py +0 -0
  35. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/pr_content_filter.py +0 -0
  36. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/reconcile_matcher.py +0 -0
  37. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/rich_display.py +0 -0
  38. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/rich_logging.py +0 -0
  39. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/similarity.py +0 -0
  40. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/ssh_agent_setup.py +0 -0
  41. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/ssh_common.py +0 -0
  42. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/ssh_discovery.py +0 -0
  43. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/trailers.py +0 -0
  44. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/src/github2gerrit/utils.py +0 -0
  45. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/conftest.py +0 -0
  46. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/fixtures/__init__.py +0 -0
  47. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/fixtures/make_repo.py +0 -0
  48. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_action_environment_mapping.py +0 -0
  49. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_action_outputs.py +0 -0
  50. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_action_pr_number_handling.py +0 -0
  51. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_action_step_validation.py +0 -0
  52. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_change_id_deduplication.py +0 -0
  53. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_cli.py +0 -0
  54. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_cli_helpers.py +0 -0
  55. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_cli_outputs_file.py +0 -0
  56. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_cli_url_and_dryrun.py +0 -0
  57. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_commit_normalization.py +0 -0
  58. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_composite_action_coverage.py +0 -0
  59. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_config_and_reviewers.py +0 -0
  60. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_config_helpers.py +0 -0
  61. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_core_close_pr_policy.py +0 -0
  62. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_core_config_and_errors.py +0 -0
  63. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_core_gerrit_backref_comment.py +0 -0
  64. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_core_gerrit_push_errors.py +0 -0
  65. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_core_gerrit_rest_results.py +0 -0
  66. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_core_integration_fixture_repo.py +0 -0
  67. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_core_prepare_commits.py +0 -0
  68. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_core_ssh_setup.py +0 -0
  69. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_duplicate_detection.py +0 -0
  70. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_email_case_normalization.py +0 -0
  71. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_external_api_framework.py +0 -0
  72. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_gerrit_change_id_footer.py +0 -0
  73. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_gerrit_rest_client.py +0 -0
  74. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_gerrit_urls.py +0 -0
  75. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_gerrit_urls_more.py +0 -0
  76. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_ghe_and_gitreview_args.py +0 -0
  77. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_github_api_helpers.py +0 -0
  78. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_github_api_retry_and_helpers.py +0 -0
  79. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_gitutils_helpers.py +0 -0
  80. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_mapping_comment_additional.py +0 -0
  81. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_mapping_comment_digest_and_backref.py +0 -0
  82. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_metadata_and_reconciliation.py +0 -0
  83. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_metadata_trailer_separation_bug.py +0 -0
  84. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_misc_small_coverage.py +0 -0
  85. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_orphan_rest_side_effects.py +0 -0
  86. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_pr_content_filter.py +0 -0
  87. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_pr_content_filter_integration.py +0 -0
  88. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_reconciliation_extracted_module.py +0 -0
  89. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_reconciliation_plan_and_orphans.py +0 -0
  90. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_reconciliation_scenarios.py +0 -0
  91. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_ssh_agent.py +0 -0
  92. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_ssh_artifact_prevention.py +0 -0
  93. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_ssh_common.py +0 -0
  94. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_ssh_discovery.py +0 -0
  95. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_trailers_additional.py +0 -0
  96. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_url_parser.py +0 -0
  97. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/tests/test_utils.py +0 -0
  98. {github2gerrit-0.1.16 → github2gerrit-0.1.17}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github2gerrit
3
- Version: 0.1.16
3
+ Version: 0.1.17
4
4
  Summary: Submit a GitHub pull request to a Gerrit repository.
5
5
  Project-URL: Homepage, https://github.com/lfreleng-actions/github2gerrit
6
6
  Project-URL: Repository, https://github.com/lfreleng-actions/github2gerrit
@@ -1749,6 +1749,10 @@ class Orchestrator:
1749
1749
  ) -> None:
1750
1750
  """Set git global config and initialize git-review if needed."""
1751
1751
  log.debug("Configuring git and git-review for %s", gerrit.host)
1752
+
1753
+ # Configure git user identity (required for merge operations)
1754
+ self._ensure_git_user_identity(inputs)
1755
+
1752
1756
  # Prefer repo-local config; fallback to global if needed
1753
1757
  try:
1754
1758
  git_config(
@@ -1761,26 +1765,7 @@ class Orchestrator:
1761
1765
  git_config(
1762
1766
  "gitreview.username", inputs.gerrit_ssh_user_g2g, global_=True
1763
1767
  )
1764
- try:
1765
- git_config(
1766
- "user.name",
1767
- inputs.gerrit_ssh_user_g2g,
1768
- global_=False,
1769
- cwd=self.workspace,
1770
- )
1771
- except GitError:
1772
- git_config("user.name", inputs.gerrit_ssh_user_g2g, global_=True)
1773
- try:
1774
- git_config(
1775
- "user.email",
1776
- inputs.gerrit_ssh_user_g2g_email,
1777
- global_=False,
1778
- cwd=self.workspace,
1779
- )
1780
- except GitError:
1781
- git_config(
1782
- "user.email", inputs.gerrit_ssh_user_g2g_email, global_=True
1783
- )
1768
+ # Git user identity is configured by _ensure_git_user_identity
1784
1769
  # Disable GPG signing to avoid interactive prompts for signing keys
1785
1770
  try:
1786
1771
  git_config(
@@ -4386,7 +4371,15 @@ class Orchestrator:
4386
4371
  """Suggest recovery actions based on merge failure analysis."""
4387
4372
  stderr = (merge_exc.stderr or "").lower()
4388
4373
 
4389
- if "conflict" in stderr:
4374
+ if (
4375
+ "committer identity unknown" in stderr
4376
+ or "empty ident name" in stderr
4377
+ ):
4378
+ return (
4379
+ "Git user identity not configured - this should be handled "
4380
+ "automatically by the tool. Please report this as a bug."
4381
+ )
4382
+ elif "conflict" in stderr:
4390
4383
  return "Check for merge conflicts in the PR files and resolve them"
4391
4384
  elif "fatal: refusing to merge unrelated histories" in stderr:
4392
4385
  return (
@@ -4516,6 +4509,67 @@ class Orchestrator:
4516
4509
 
4517
4510
  log.error("=== End verbose merge failure analysis ===")
4518
4511
 
4512
+ def _ensure_git_user_identity(self, inputs: Inputs) -> None:
4513
+ """Ensure git user identity is configured for merge operations."""
4514
+ log.debug("Ensuring git user identity is configured")
4515
+
4516
+ # Check if user.name and user.email are already configured
4517
+ try:
4518
+ name_result = run_cmd(
4519
+ ["git", "config", "user.name"], cwd=self.workspace, check=False
4520
+ )
4521
+ email_result = run_cmd(
4522
+ ["git", "config", "user.email"], cwd=self.workspace, check=False
4523
+ )
4524
+
4525
+ if (
4526
+ name_result.returncode == 0
4527
+ and name_result.stdout.strip()
4528
+ and email_result.returncode == 0
4529
+ and email_result.stdout.strip()
4530
+ ):
4531
+ log.debug(
4532
+ "Git user identity already configured: %s <%s>",
4533
+ name_result.stdout.strip(),
4534
+ email_result.stdout.strip(),
4535
+ )
4536
+ return
4537
+
4538
+ except Exception as e:
4539
+ log.debug("Failed to check existing git identity: %s", e)
4540
+
4541
+ # Configure git identity using Gerrit credentials
4542
+ user_name = inputs.gerrit_ssh_user_g2g or "github2gerrit-bot"
4543
+ user_email = (
4544
+ inputs.gerrit_ssh_user_g2g_email or "github2gerrit@example.com"
4545
+ )
4546
+
4547
+ log.debug("Configuring git identity: %s <%s>", user_name, user_email)
4548
+
4549
+ try:
4550
+ # Set local repository identity
4551
+ run_cmd(
4552
+ ["git", "config", "user.name", user_name], cwd=self.workspace
4553
+ )
4554
+ run_cmd(
4555
+ ["git", "config", "user.email", user_email], cwd=self.workspace
4556
+ )
4557
+ log.debug("Successfully configured git user identity")
4558
+
4559
+ except CommandError as e:
4560
+ # Fallback to global config if local fails
4561
+ log.warning(
4562
+ "Failed to set local git identity, trying global: %s", e
4563
+ )
4564
+ try:
4565
+ run_cmd(["git", "config", "--global", "user.name", user_name])
4566
+ run_cmd(["git", "config", "--global", "user.email", user_email])
4567
+ log.debug("Successfully configured global git user identity")
4568
+ except CommandError as global_e:
4569
+ log.exception("Failed to configure git user identity")
4570
+ msg = "Cannot configure git user identity"
4571
+ raise OrchestratorError(msg) from global_e
4572
+
4519
4573
 
4520
4574
  # ---------------------
4521
4575
  # Utility functions
File without changes
File without changes
File without changes
File without changes
File without changes