github2gerrit 2.0.0__tar.gz → 2.1.1__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 (143) hide show
  1. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/.pre-commit-config.yaml +27 -7
  2. github2gerrit-2.1.1/LICENSES/Apache-2.0.txt +201 -0
  3. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/PKG-INFO +9 -2
  4. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/README.md +6 -0
  5. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/docs/cli.md +1 -0
  6. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/docs/features.md +132 -3
  7. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/pyproject.toml +80 -45
  8. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/cli.py +282 -43
  9. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/config.py +109 -0
  10. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/core.py +139 -24
  11. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/duplicate_detection.py +17 -5
  12. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/github_api.py +109 -0
  13. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/models.py +16 -4
  14. github2gerrit-2.1.1/src/github2gerrit/pr_approval.py +300 -0
  15. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/pr_commands.py +79 -15
  16. github2gerrit-2.1.1/src/github2gerrit/pr_directives.py +115 -0
  17. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/ssh_config_parser.py +36 -60
  18. github2gerrit-2.1.1/src/github2gerrit/trust.py +122 -0
  19. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/conftest.py +29 -0
  20. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/fixtures/make_repo.py +3 -10
  21. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_action_environment_mapping.py +27 -0
  22. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_action_outputs.py +3 -0
  23. github2gerrit-2.1.1/tests/test_cache_isolation.py +210 -0
  24. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_cli.py +9 -17
  25. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_cli_helpers.py +140 -0
  26. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_cli_outputs_file.py +12 -3
  27. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_cli_url_and_dryrun.py +1 -1
  28. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_composite_action_coverage.py +14 -5
  29. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_config_helpers.py +326 -0
  30. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_integration_fixture_repo.py +1 -1
  31. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_prepare_commits.py +1 -1
  32. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_ssh_setup.py +5 -5
  33. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_duplicate_detection.py +455 -0
  34. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_error_codes.py +21 -10
  35. github2gerrit-2.1.1/tests/test_fork_approval_gate.py +679 -0
  36. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gerrit_change_id_footer.py +1 -1
  37. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gerrit_pr_closer.py +1 -0
  38. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gerrit_ssh_abandon.py +2 -3
  39. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gerrit_urls_more.py +7 -14
  40. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_mapping_comment_additional.py +59 -32
  41. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_mapping_comment_digest_and_backref.py +3 -4
  42. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_misc_small_coverage.py +1 -1
  43. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_orphan_rest_side_effects.py +11 -10
  44. github2gerrit-2.1.1/tests/test_pr_command_authorisation.py +357 -0
  45. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_pr_commands.py +15 -8
  46. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_pr_content_filter_integration.py +1 -1
  47. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_reconciliation_extracted_module.py +42 -24
  48. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_reconciliation_plan_and_orphans.py +46 -26
  49. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_ssh_agent_ownership.py +39 -9
  50. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_ssh_artifact_prevention.py +10 -0
  51. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/unit/test_config_integration.py +6 -19
  52. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/unit/test_ssh_config_parser.py +159 -72
  53. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/uv.lock +37 -24
  54. github2gerrit-2.0.0/LICENSE +0 -1
  55. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/.aislop/config.yml +0 -0
  56. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/.editorconfig +0 -0
  57. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/.gitignore +0 -0
  58. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/.gitlint +0 -0
  59. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/.markdownlint.yaml +0 -0
  60. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/.yamllint +0 -0
  61. /github2gerrit-2.0.0/LICENSES/Apache-2.0.txt → /github2gerrit-2.1.1/LICENSE +0 -0
  62. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/REUSE.toml +0 -0
  63. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/SECURITY.md +0 -0
  64. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/action.yaml +0 -0
  65. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/docs/COMMIT_RULES.md +0 -0
  66. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/docs/development.md +0 -0
  67. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/docs/github2gerrit_token_permissions_classic.png +0 -0
  68. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/sitecustomize.py +0 -0
  69. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/__init__.py +0 -0
  70. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/commit_normalization.py +0 -0
  71. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/commit_rules.py +0 -0
  72. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/constants.py +0 -0
  73. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/error_codes.py +0 -0
  74. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/external_api.py +0 -0
  75. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/gerrit_pr_closer.py +0 -0
  76. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/gerrit_query.py +0 -0
  77. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/gerrit_rest.py +0 -0
  78. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/gerrit_ssh.py +0 -0
  79. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/gerrit_urls.py +0 -0
  80. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/gitreview.py +0 -0
  81. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/gitutils.py +0 -0
  82. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/mapping_comment.py +0 -0
  83. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/netrc.py +0 -0
  84. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/orchestrator/__init__.py +0 -0
  85. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/orchestrator/reconciliation.py +0 -0
  86. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/pr_content_filter.py +0 -0
  87. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/reconcile_matcher.py +0 -0
  88. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/rich_display.py +0 -0
  89. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/rich_logging.py +0 -0
  90. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/similarity.py +0 -0
  91. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/ssh_agent_setup.py +0 -0
  92. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/ssh_common.py +0 -0
  93. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/ssh_discovery.py +0 -0
  94. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/trailers.py +0 -0
  95. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/src/github2gerrit/utils.py +0 -0
  96. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/fixtures/__init__.py +0 -0
  97. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/fixtures/ssh_config_samples.py +0 -0
  98. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_action_pr_number_handling.py +0 -0
  99. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_action_step_validation.py +0 -0
  100. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_automation_only.py +0 -0
  101. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_change_id_deduplication.py +0 -0
  102. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_clean_squash_title.py +0 -0
  103. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_cli_netrc_options.py +0 -0
  104. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_commit_normalization.py +0 -0
  105. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_commit_rules.py +0 -0
  106. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_config_and_reviewers.py +0 -0
  107. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_close_pr_policy.py +0 -0
  108. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_config_and_errors.py +0 -0
  109. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_gerrit_backref_comment.py +0 -0
  110. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_gerrit_push_errors.py +0 -0
  111. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_gerrit_rest_results.py +0 -0
  112. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_shallow_clone.py +0 -0
  113. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_core_ssrf_protection.py +0 -0
  114. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_dependency_supersession.py +0 -0
  115. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_dns_validation_and_no_gerrit.py +0 -0
  116. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_email_case_normalization.py +0 -0
  117. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_external_api_framework.py +0 -0
  118. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_final_state_reconciliation.py +0 -0
  119. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_force_flag_cli.py +0 -0
  120. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_fork_pr_hardening.py +0 -0
  121. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gerrit_change_status_checks.py +0 -0
  122. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gerrit_rest_client.py +0 -0
  123. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gerrit_urls.py +0 -0
  124. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_ghe_and_gitreview_args.py +0 -0
  125. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_github_api_error_handling.py +0 -0
  126. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_github_api_helpers.py +0 -0
  127. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_github_api_retry_and_helpers.py +0 -0
  128. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gitreview.py +0 -0
  129. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_gitutils_helpers.py +0 -0
  130. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_issue_157_regressions.py +0 -0
  131. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_metadata_and_reconciliation.py +0 -0
  132. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_metadata_trailer_separation_bug.py +0 -0
  133. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_netrc.py +0 -0
  134. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_pr_content_filter.py +0 -0
  135. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_pr_update_detection.py +0 -0
  136. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_reconciliation_scenarios.py +0 -0
  137. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_ssh_agent.py +0 -0
  138. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_ssh_common.py +0 -0
  139. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_ssh_discovery.py +0 -0
  140. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_ssh_discovery_dry_run.py +0 -0
  141. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_trailers_additional.py +0 -0
  142. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_url_parser.py +0 -0
  143. {github2gerrit-2.0.0 → github2gerrit-2.1.1}/tests/test_utils.py +0 -0
@@ -64,20 +64,38 @@ repos:
64
64
  types: [yaml]
65
65
 
66
66
  - repo: https://github.com/astral-sh/ruff-pre-commit
67
- rev: 65dbdb59d2f2d9c3bdc343c566821ad3319ddaa3 # frozen: v0.16.3
67
+ rev: 1f1e8bf348ff38fc88619a38d3ca4d9c56abea49 # frozen: v0.16.5
68
68
  hooks:
69
69
  - id: ruff
70
- files: ^(src|scripts|tests)/.+\.py$
70
+ files: ^(src|scripts|tests)/.+\.py$|^sitecustomize\.py$
71
71
  args: [--fix, --exit-non-zero-on-fix]
72
72
  - id: ruff-format
73
- files: ^(src|scripts|tests)/.+\.py$
73
+ files: ^(src|scripts|tests)/.+\.py$|^sitecustomize\.py$
74
74
 
75
75
  - repo: https://github.com/pre-commit/mirrors-mypy
76
76
  rev: 7ff8d35ae36a7d2b968f2f90b4c723e292e594ee # frozen: v2.3.1
77
77
  hooks:
78
78
  - id: mypy
79
- files: ^src/.+\.py$
79
+ # Every Python path in the repository, matching the ruff and
80
+ # basedpyright hooks above and below so the three cannot drift.
81
+ files: ^(src|scripts|tests)/.+\.py$|^sitecustomize\.py$
82
+ # mypy runs in an isolated virtualenv that holds only what is
83
+ # listed here, so anything the checked files import has to be
84
+ # present or mypy draws conclusions the project never would. With
85
+ # pytest absent, for instance, @pytest.fixture reads as an untyped
86
+ # decorator and pytest.raises stops telling mypy the block can
87
+ # swallow the exception, which turns every statement after a
88
+ # `with pytest.raises(...)` into dead code. Installing the real
89
+ # packages removes that whole class of environment-only findings;
90
+ # keep this list in step with the imports under src/ and tests/.
91
+ # pygerrit2 is deliberately absent: it is an optional runtime
92
+ # dependency and pyproject.toml already gives it
93
+ # ignore_missing_imports.
80
94
  additional_dependencies:
95
+ - click>=8.2
96
+ - pytest
97
+ - responses
98
+ - typer
81
99
  - types-PyYAML
82
100
  - types-requests
83
101
 
@@ -89,7 +107,7 @@ repos:
89
107
  args: ["--no-adverb"]
90
108
 
91
109
  - repo: https://github.com/shellcheck-py/shellcheck-py
92
- rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1
110
+ rev: a6564f5d57444e123433a5c9af733e3975c77229 # frozen: v0.11.0.1-1
93
111
  hooks:
94
112
  - id: shellcheck
95
113
 
@@ -123,10 +141,12 @@ repos:
123
141
  rev: 3c94d276aa3005fa1f5a977946c9dc106135c083 # frozen: 1.39.10
124
142
  hooks:
125
143
  - id: basedpyright
126
- files: ^src/.+\.py$
144
+ # Every Python path in the repository. Keep in sync with the
145
+ # `include` list under [tool.pyright] in pyproject.toml.
146
+ files: ^(src|scripts|tests)/.+\.py$|^sitecustomize\.py$
127
147
 
128
148
  - repo: https://github.com/lfreleng-actions/gha-workflow-linter
129
- rev: 7f11ad46be1cd2b3d778428d40fcb09309bb3be5 # frozen: v1.4.1
149
+ rev: cae470a1e8988c3cacbe9cc40a0d6b8e6881bde2 # frozen: v1.5.5
130
150
  hooks:
131
151
  - id: gha-workflow-linter
132
152
 
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: github2gerrit
3
- Version: 2.0.0
3
+ Version: 2.1.1
4
4
  Summary: Submit a GitHub pull request to a Gerrit repository.
5
5
  Project-URL: Homepage, https://github.com/lfreleng-actions/github2gerrit-action
6
6
  Project-URL: Repository, https://github.com/lfreleng-actions/github2gerrit-action
@@ -22,7 +22,6 @@ Classifier: Topic :: Software Development :: Build Tools
22
22
  Classifier: Topic :: Software Development :: Version Control
23
23
  Classifier: Typing :: Typed
24
24
  Requires-Python: >=3.11
25
- Requires-Dist: click>=8.1.7
26
25
  Requires-Dist: cryptography>=48.0.1
27
26
  Requires-Dist: git-review>=2.5.0
28
27
  Requires-Dist: pygerrit2>=2.0.15
@@ -33,6 +32,7 @@ Requires-Dist: rich>=14.2.0
33
32
  Requires-Dist: typer>=0.20.1
34
33
  Requires-Dist: urllib3>=2.6.3
35
34
  Provides-Extra: dev
35
+ Requires-Dist: click>=8.2; extra == 'dev'
36
36
  Requires-Dist: coverage[toml]>=7.10.6; extra == 'dev'
37
37
  Requires-Dist: mypy>=1.17.1; extra == 'dev'
38
38
  Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
@@ -40,6 +40,7 @@ Requires-Dist: pytest-mock>=3.15.1; extra == 'dev'
40
40
  Requires-Dist: pytest>=9.0.2; extra == 'dev'
41
41
  Requires-Dist: responses>=0.25.8; extra == 'dev'
42
42
  Requires-Dist: ruff>=0.6.3; extra == 'dev'
43
+ Requires-Dist: types-pyyaml>=6.0.12; extra == 'dev'
43
44
  Requires-Dist: types-requests>=2.31.0; extra == 'dev'
44
45
  Requires-Dist: types-urllib3>=1.26.25.14; extra == 'dev'
45
46
  Description-Content-Type: text/markdown
@@ -139,6 +140,9 @@ name: github2gerrit
139
140
  on:
140
141
  pull_request_target:
141
142
  types: [opened, reopened, edited, synchronize, closed]
143
+ # Re-runs when a maintainer approves a fork pull request
144
+ pull_request_review:
145
+ types: [submitted, dismissed]
142
146
  push:
143
147
  branches: [main, master]
144
148
  workflow_dispatch:
@@ -186,6 +190,9 @@ name: github2gerrit
186
190
  on:
187
191
  pull_request_target:
188
192
  types: [opened, reopened, edited, synchronize, closed]
193
+ # Re-runs when a maintainer approves a fork pull request
194
+ pull_request_review:
195
+ types: [submitted, dismissed]
189
196
  workflow_dispatch:
190
197
 
191
198
  permissions:
@@ -93,6 +93,9 @@ name: github2gerrit
93
93
  on:
94
94
  pull_request_target:
95
95
  types: [opened, reopened, edited, synchronize, closed]
96
+ # Re-runs when a maintainer approves a fork pull request
97
+ pull_request_review:
98
+ types: [submitted, dismissed]
96
99
  push:
97
100
  branches: [main, master]
98
101
  workflow_dispatch:
@@ -140,6 +143,9 @@ name: github2gerrit
140
143
  on:
141
144
  pull_request_target:
142
145
  types: [opened, reopened, edited, synchronize, closed]
146
+ # Re-runs when a maintainer approves a fork pull request
147
+ pull_request_review:
148
+ types: [submitted, dismissed]
143
149
  workflow_dispatch:
144
150
 
145
151
  permissions:
@@ -165,6 +165,7 @@ Some settings have no CLI flag and use environment variables:
165
165
  | `G2G_LOG_LEVEL` | `WARNING` | Logging level; set `DEBUG` for verbose output |
166
166
  | `G2G_TOPIC_PREFIX` | `GH` | Prefix used when generating Gerrit topics |
167
167
  | `G2G_SKIP_GERRIT_COMMENTS` | `false` | Skip posting back-reference comments on Gerrit changes |
168
+ | `G2G_TRUSTED_ASSOCIATIONS` | `OWNER,MEMBER,COLLABORATOR` | Author associations trusted to issue `@github2gerrit` comment directives |
168
169
  | `G2G_ENABLE_DERIVATION` | `true` | Enable automatic derivation of Gerrit parameters from organization defaults |
169
170
  | `G2G_AUTO_SAVE_CONFIG` | context-dependent | Save derived parameters back to the configuration file |
170
171
  | `G2G_RESPECT_USER_SSH` | `false` (`true` in direct URL mode) | Use the local user's SSH configuration and keys instead of provided key material |
@@ -102,6 +102,57 @@ acts on it during the next workflow run.
102
102
  - When the same command appears in more than one comment, only the latest
103
103
  occurrence takes effect.
104
104
  - The tool logs unrecognized directives at debug level and ignores them.
105
+ - Only comments from trusted authors count. See below.
106
+
107
+ ### Who May Issue Commands
108
+
109
+ These repositories are public, so the tool checks who wrote a comment before
110
+ acting on it. Without that check, any GitHub user able to leave a comment
111
+ could direct the tool.
112
+
113
+ A comment counts only when GitHub reports its author's `author_association`
114
+ as one of:
115
+
116
+ | Association | Meaning |
117
+ | -------------- | ------------------------------------------ |
118
+ | `OWNER` | Owns the repository |
119
+ | `MEMBER` | Member of the owning organization |
120
+ | `COLLABORATOR` | Invited collaborator on the repository |
121
+
122
+ `CONTRIBUTOR` is **not** trusted. It means only that the author has had a
123
+ pull request merged at some point, which any outside contributor can achieve
124
+ and which carries no authority.
125
+
126
+ The tool ignores directives from anyone else and logs a warning naming the
127
+ author and their association, so a refused command is visible rather than
128
+ silently dropped.
129
+
130
+ #### For contributors adding commands
131
+
132
+ Adding a `CommandDefinition` to the registry gives the new command the same
133
+ authorisation as the existing one, so long as consumers reach it through
134
+ `github2gerrit.pr_directives`, which fetches comments, discards untrusted
135
+ authors and parses in a single step.
136
+
137
+ The parsing module performs no authorisation of its own. Calling
138
+ `parse_commands`, `find_command` or `has_command` with comments taken straight
139
+ from the GitHub API skips the check and recreates the original defect.
140
+
141
+ Override the trusted set with `G2G_TRUSTED_ASSOCIATIONS`, a comma-separated
142
+ list. Setting it to `OWNER` alone is the strictest useful value:
143
+
144
+ ```yaml
145
+ env:
146
+ G2G_TRUSTED_ASSOCIATIONS: "OWNER,MEMBER"
147
+ ```
148
+
149
+ An empty or blank value keeps the default rather than trusting nobody or
150
+ everyone.
151
+
152
+ Note that `MEMBER` means organization member, which is not the same as write
153
+ access to a given repository. On a Gerrit mirror that remains the only
154
+ available signal, because the GitHub collaborator list holds infrastructure
155
+ accounts rather than the project's reviewers.
105
156
 
106
157
  ### Available Commands
107
158
 
@@ -349,9 +400,87 @@ Same-repository pull requests keep their previous behaviour and still read
349
400
 
350
401
  ### Approval gating
351
402
 
352
- The tool does not yet require a maintainer approval before it transfers a fork
353
- pull request to Gerrit. Until it does, use `AUTOMATION_ONLY` (see above) to
354
- control which pull requests the tool accepts.
403
+ A fork pull request does not transfer to Gerrit until a maintainer approves it.
404
+ The check runs before the tool fetches anything from the pull request and before
405
+ it unlocks the Gerrit SSH key, so a pull request awaiting review reaches
406
+ neither.
407
+
408
+ Same-repository pull requests skip the check entirely. Pushing a branch to the
409
+ base repository already requires write access, and automation such as
410
+ Dependabot, pre-commit.ci and Copilot works that way, so the gate never affects
411
+ them.
412
+
413
+ #### What counts as approval
414
+
415
+ An approving review, where every one of the following holds:
416
+
417
+ - the reviewer's `author_association` falls in the trusted set, the same one
418
+ used for [comment commands](#who-may-issue-commands);
419
+ - the review targets the pull request's **current head commit**;
420
+ - no trusted reviewer has since requested changes; and
421
+ - the reviewer is not the pull request author.
422
+
423
+ A pull request whose provenance the tool cannot establish takes the same path as
424
+ a fork. Approval is a question about authority, and an absent signal is not an
425
+ answer.
426
+
427
+ The gate applies to unattended runs. Running the CLI directly against a pull
428
+ request URL does not require an approval: the operator chose that pull request
429
+ and is using their own credentials, so they are already the authority the gate
430
+ looks for. It exists for the automated path, where the tool acts on a shared
431
+ identity with nobody watching.
432
+
433
+ Binding to the head commit matters. GitHub keeps approvals across pushes unless
434
+ branch protection dismisses them, so an approval that was not checked against a
435
+ commit would let a contributor gain approval for one revision and then push a
436
+ different one. The cost is that maintainers re-approve after each push, which is
437
+ the correct trade.
438
+
439
+ The author exclusion is belt and braces. GitHub already rejects approving your
440
+ own pull request, and that guarantee is a large part of why the tool uses
441
+ reviews rather than comment directives — on a Gerrit mirror the pull request
442
+ author often holds the same organization membership as the reviewers.
443
+
444
+ #### Enabling re-runs on approval
445
+
446
+ `pull_request_target` carries no event for a submitted review, so approving a
447
+ pull request does nothing unless the calling workflow listens for it:
448
+
449
+ ```yaml
450
+ on:
451
+ pull_request_target:
452
+ types: [opened, reopened, edited, synchronize, closed]
453
+ pull_request_review:
454
+ types: [submitted, dismissed]
455
+ ```
456
+
457
+ Without that trigger the tool only reconsiders a pull request on its next
458
+ push, or when a maintainer dispatches the workflow by hand.
459
+
460
+ #### When the gate blocks
461
+
462
+ The run finishes successfully rather than failing. A pull request waiting for a
463
+ human is not broken, and a red check would suggest otherwise.
464
+
465
+ The tool posts one comment explaining what is missing, and edits that same
466
+ comment on later runs rather than adding another. Where an approval exists but
467
+ covers an earlier commit, the comment says so, so a maintainer who did approve
468
+ is not told that nobody has.
469
+
470
+ Once approval arrives, the tool edits that comment again to record it, so a
471
+ transferred pull request does not keep displaying a stale block.
472
+
473
+ #### If the head moves mid-run
474
+
475
+ The gate reads the head commit from the API, while the workspace fetch reads
476
+ `refs/pull/<N>/head`, which the contributor can move meanwhile. The tool
477
+ compares the commit it fetched against the commit the maintainer approved and
478
+ refuses a mismatch, so a push timed against a running workflow cannot slip an
479
+ unreviewed commit into Gerrit.
480
+
481
+ That refusal fails the run, unlike the ordinary blocked case, because it falls
482
+ outside the normal course of events. The push that caused it triggers a fresh
483
+ run, which asks for approval of the new commit in the usual way.
355
484
 
356
485
  ## Duplicate Detection
357
486