git-bot-feedback 0.5.1__tar.gz → 0.6.0__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.
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/AGENTS.md +5 -4
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/CHANGELOG.md +23 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/CONTRIBUTING.md +26 -6
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/Cargo.lock +18 -18
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/Cargo.toml +2 -2
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/PKG-INFO +1 -1
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/README.md +5 -4
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/bindings/python/CHANGELOG.md +33 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/bindings/python/Cargo.toml +4 -4
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/bindings/python/git_bot_feedback.pyi +38 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/bindings/python/src/lib.rs +16 -0
- git_bot_feedback-0.6.0/bindings/python/src/py_types.rs +232 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/bindings/python/src/wrapper.rs +157 -96
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/cspell.config.yml +3 -0
- git_bot_feedback-0.6.0/docs/API/errors.rst +12 -0
- git_bot_feedback-0.6.0/docs/API/http.rst +8 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/API/index.rst +2 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/git_bot_feedback.pyi +38 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/nurfile +12 -0
- git_bot_feedback-0.6.0/src/client/common.rs +87 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/gitea/mod.rs +44 -7
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/gitea/specific_api.rs +190 -48
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/github/mod.rs +25 -24
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/github/specific_api.rs +84 -211
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/gitlab/mod.rs +34 -3
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/gitlab/specific_api.rs +141 -12
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/mod.rs +115 -0
- git_bot_feedback-0.6.0/src/file_annotations.rs +442 -0
- git_bot_feedback-0.6.0/uv.lock +942 -0
- git_bot_feedback-0.5.1/src/client/common.rs +0 -31
- git_bot_feedback-0.5.1/src/file_annotations.rs +0 -117
- git_bot_feedback-0.5.1/uv.lock +0 -658
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/.gitattributes +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/.gitignore +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/.pre-commit-config.yaml +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/LICENSE +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/README.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/bindings/python/README.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/build.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/codecov.yml +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/API/client.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/API/file-annotations.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/API/file-changes.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/API/output-variables.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/API/pr-reviews.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/API/thread-comments.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/_static/favicon.ico +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/_static/logo.png +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/conf.py +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/index.rst +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/logo.xcf +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/docs/permissions/gitlab.md +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/pyproject.toml +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/gitea/serde_structs.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/github/graphql.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/github/serde_structs.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/gitlab/diff_positions.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/gitlab/reviews.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/gitlab/serde_structs.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/client/local.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/comments/mod.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/comments/review_comments.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/comments/thread_comments.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/error.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/file_utils/file_filter.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/file_utils/mod.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/git_diff.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/lib.rs +0 -0
- {git_bot_feedback-0.5.1 → git_bot_feedback-0.6.0}/src/output_variable.rs +0 -0
|
@@ -12,11 +12,11 @@ This document provides conventions, architectural context, and workflow commands
|
|
|
12
12
|
|
|
13
13
|
## Critical Invariants & Rules
|
|
14
14
|
|
|
15
|
-
### 1. Test Execution
|
|
15
|
+
### 1. Test Execution Rules
|
|
16
16
|
> [!IMPORTANT]
|
|
17
|
-
> Do **not** run raw `cargo test` for unit or integration tests!
|
|
18
|
-
> The test suite relies heavily on manipulating environment variables. `cargo test` executes tests concurrently within the same process space, causing severe cross-test pollution and intermittent failures.
|
|
19
|
-
> Always execute tests through `cargo-nextest` (or `nur test`), which provides process isolation for each individual test.
|
|
17
|
+
> Do **not** run raw `cargo test` for Rust unit or integration tests!
|
|
18
|
+
> The Rust test suite relies heavily on manipulating environment variables. `cargo test` executes tests concurrently within the same process space, causing severe cross-test pollution and intermittent failures.
|
|
19
|
+
> Always execute Rust tests through `cargo-nextest` (or `nur test`), which provides process isolation for each individual test. Python binding tests must be written in Python under `bindings/python/tests` and run with `uv run --group test pytest bindings/python/tests` or `nur test py [--clean]`.
|
|
20
20
|
|
|
21
21
|
Note, this project is primarily hosted on GitHub; any mirrors on other platforms are considered unofficial. Therefore, the CI workflows and tests all are designed for GitHub Actions.
|
|
22
22
|
|
|
@@ -46,6 +46,7 @@ This project uses [nur](https://crates.io/crates/nur) (a task runner using Nushe
|
|
|
46
46
|
| :--- | :--- | :--- |
|
|
47
47
|
| **Run Tests** | `nur test` | Runs tests with `cargo-nextest` under the `default` profile (marks tests > 10s as "SLOW"). |
|
|
48
48
|
| **Run CI Tests** | `nur test -p ci` | Runs all tests including slow tests with verbose output. |
|
|
49
|
+
| **Run Python Tests** | `nur test py` | Runs the Python binding's pytest suite under `bindings/python/tests`. |
|
|
49
50
|
| **Run Doc Tests** | `nur test docs` | Runs doc tests (`cargo test --doc --features file-changes`). |
|
|
50
51
|
| **Generate Coverage** | `nur test lcov` / `nur test html` | Generates LCOV or HTML coverage via `cargo-llvm-cov`. |
|
|
51
52
|
| **Lint & Format Check** | `nur lint --check` | Runs `cargo clippy --workspace --features file-changes --all-targets -- -D warnings` and `cargo fmt -- --check`. |
|
|
@@ -6,6 +6,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
<!-- markdownlint-disable MD024 -->
|
|
8
8
|
|
|
9
|
+
## [git-bot-feedback/v0.12.0] - 2026-11-06
|
|
10
|
+
|
|
11
|
+
### <!-- 1 --> 🚀 Added
|
|
12
|
+
|
|
13
|
+
- Add `RestApiClient::is_pr_same_remote()` by @2bndy5 in [#160](https://github.com/2bndy5/git-bot-feedback/pull/160)
|
|
14
|
+
- Add request, response, and error types by @2bndy5 in [#161](https://github.com/2bndy5/git-bot-feedback/pull/161)
|
|
15
|
+
|
|
16
|
+
### <!-- 4 --> 🛠️ Fixed
|
|
17
|
+
|
|
18
|
+
- Use the API root set by Gitea's runner and fill in missing methods by @shenxianpeng in [#162](https://github.com/2bndy5/git-bot-feedback/pull/162)
|
|
19
|
+
|
|
20
|
+
### <!-- 9 --> 🗨️ Changed
|
|
21
|
+
|
|
22
|
+
- Eliminate fallback to "unknown" event name by @2bndy5 in [#164](https://github.com/2bndy5/git-bot-feedback/pull/164)
|
|
23
|
+
|
|
24
|
+
[git-bot-feedback/v0.12.0]: https://github.com/2bndy5/git-bot-feedback/compare/git-bot-feedback/v0.11.0...git-bot-feedback/v0.12.0
|
|
25
|
+
|
|
26
|
+
Full commit diff: [`git-bot-feedback/v0.11.0...git-bot-feedback/v0.12.0`][git-bot-feedback/v0.12.0]
|
|
27
|
+
|
|
9
28
|
## [git-bot-feedback/v0.11.0] - 2026-10-27
|
|
10
29
|
|
|
11
30
|
### <!-- 1 --> 🚀 Added
|
|
@@ -16,6 +35,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
35
|
|
|
17
36
|
- Add impl for `GitlabApiClient::workspace_root()` by @2bndy5 in [#153](https://github.com/2bndy5/git-bot-feedback/pull/153)
|
|
18
37
|
|
|
38
|
+
### <!-- 6 --> 📦 Dependency updates
|
|
39
|
+
|
|
40
|
+
- Bump version to git-bot-feedback/v0.11.0 by @2bndy5 in [`b6d5b08`](https://github.com/2bndy5/git-bot-feedback/commit/b6d5b085a1a43268818b1c4ded00e62fc649b15a)
|
|
41
|
+
|
|
19
42
|
[git-bot-feedback/v0.11.0]: https://github.com/2bndy5/git-bot-feedback/compare/git-bot-feedback/v0.10.0...git-bot-feedback/v0.11.0
|
|
20
43
|
|
|
21
44
|
Full commit diff: [`git-bot-feedback/v0.10.0...git-bot-feedback/v0.11.0`][git-bot-feedback/v0.11.0]
|
|
@@ -86,10 +86,9 @@ nur lint
|
|
|
86
86
|
## Testing
|
|
87
87
|
|
|
88
88
|
> [!WARNING]
|
|
89
|
-
> Do not use `cargo test` to run
|
|
90
|
-
>
|
|
91
|
-
>
|
|
92
|
-
> context. See
|
|
89
|
+
> Do not use `cargo test` to run Rust unit or integration tests. These tests
|
|
90
|
+
> heavily rely on manipulating environment variables, so use [cargo-nextest] to
|
|
91
|
+
> isolate each test in its own environment context. See
|
|
93
92
|
> [cargo-nextest documentation about altering environment variables][cargo-nextest-env-docs].
|
|
94
93
|
|
|
95
94
|
[cargo-nextest-env-docs]: https://nexte.st/docs/configuration/env-vars/#altering-the-environment-within-tests
|
|
@@ -101,8 +100,11 @@ various test options (applicable to this project) into tasks.
|
|
|
101
100
|
|
|
102
101
|
### Running tests
|
|
103
102
|
|
|
104
|
-
|
|
105
|
-
[cargo-llvm-cov].
|
|
103
|
+
Rust unit and integration tests are written in Rust and run using
|
|
104
|
+
[cargo-nextest]. Rust coverage is measured by [cargo-llvm-cov].
|
|
105
|
+
|
|
106
|
+
The Python binding code does not get measured for code coverage.
|
|
107
|
+
See [running python tests below](#running-python-tests).
|
|
106
108
|
|
|
107
109
|
#### Run the tests
|
|
108
110
|
|
|
@@ -150,6 +152,24 @@ nur test lcov
|
|
|
150
152
|
|
|
151
153
|
</details>
|
|
152
154
|
|
|
155
|
+
### Running Python tests
|
|
156
|
+
|
|
157
|
+
Python binding tests are written in Python under
|
|
158
|
+
`bindings/python/tests` and run using [uv] and pytest:
|
|
159
|
+
|
|
160
|
+
```shell
|
|
161
|
+
uv run --group test pytest bindings/python/tests
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The equivalent [nur] task is:
|
|
165
|
+
|
|
166
|
+
```shell
|
|
167
|
+
nur test py
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
> [!TIP]
|
|
171
|
+
> Use `--clean`/`-c` arg to `nur test py` to rebuild the binding from scratch.
|
|
172
|
+
|
|
153
173
|
## API documentation
|
|
154
174
|
|
|
155
175
|
Documentation is hosted at docs.rs automatically upon release. To verify any
|
|
@@ -413,7 +413,7 @@ dependencies = [
|
|
|
413
413
|
|
|
414
414
|
[[package]]
|
|
415
415
|
name = "git-bot-feedback"
|
|
416
|
-
version = "0.
|
|
416
|
+
version = "0.12.0"
|
|
417
417
|
dependencies = [
|
|
418
418
|
"async-trait",
|
|
419
419
|
"chrono",
|
|
@@ -433,7 +433,7 @@ dependencies = [
|
|
|
433
433
|
|
|
434
434
|
[[package]]
|
|
435
435
|
name = "git-bot-feedback-py"
|
|
436
|
-
version = "0.
|
|
436
|
+
version = "0.6.0"
|
|
437
437
|
dependencies = [
|
|
438
438
|
"git-bot-feedback",
|
|
439
439
|
"pyo3",
|
|
@@ -992,9 +992,9 @@ dependencies = [
|
|
|
992
992
|
|
|
993
993
|
[[package]]
|
|
994
994
|
name = "pyo3"
|
|
995
|
-
version = "0.
|
|
995
|
+
version = "0.30.1"
|
|
996
996
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
997
|
-
checksum = "
|
|
997
|
+
checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
|
|
998
998
|
dependencies = [
|
|
999
999
|
"libc",
|
|
1000
1000
|
"once_cell",
|
|
@@ -1006,9 +1006,9 @@ dependencies = [
|
|
|
1006
1006
|
|
|
1007
1007
|
[[package]]
|
|
1008
1008
|
name = "pyo3-async-runtimes"
|
|
1009
|
-
version = "0.
|
|
1009
|
+
version = "0.30.0"
|
|
1010
1010
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1011
|
-
checksum = "
|
|
1011
|
+
checksum = "b877331c7817ccb6379e9d19a06993160141f1d0a386e55276128717df85e3fc"
|
|
1012
1012
|
dependencies = [
|
|
1013
1013
|
"futures-channel",
|
|
1014
1014
|
"futures-util",
|
|
@@ -1020,18 +1020,18 @@ dependencies = [
|
|
|
1020
1020
|
|
|
1021
1021
|
[[package]]
|
|
1022
1022
|
name = "pyo3-build-config"
|
|
1023
|
-
version = "0.
|
|
1023
|
+
version = "0.30.1"
|
|
1024
1024
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1025
|
-
checksum = "
|
|
1025
|
+
checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
|
|
1026
1026
|
dependencies = [
|
|
1027
1027
|
"target-lexicon",
|
|
1028
1028
|
]
|
|
1029
1029
|
|
|
1030
1030
|
[[package]]
|
|
1031
1031
|
name = "pyo3-ffi"
|
|
1032
|
-
version = "0.
|
|
1032
|
+
version = "0.30.1"
|
|
1033
1033
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1034
|
-
checksum = "
|
|
1034
|
+
checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
|
|
1035
1035
|
dependencies = [
|
|
1036
1036
|
"libc",
|
|
1037
1037
|
"pyo3-build-config",
|
|
@@ -1039,9 +1039,9 @@ dependencies = [
|
|
|
1039
1039
|
|
|
1040
1040
|
[[package]]
|
|
1041
1041
|
name = "pyo3-log"
|
|
1042
|
-
version = "0.13.
|
|
1042
|
+
version = "0.13.5"
|
|
1043
1043
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1044
|
-
checksum = "
|
|
1044
|
+
checksum = "b91aabf1c0d674a2e3b0b55daab6cef1308ce6f0ad3697ae56f4f68db54c98a1"
|
|
1045
1045
|
dependencies = [
|
|
1046
1046
|
"arc-swap",
|
|
1047
1047
|
"log",
|
|
@@ -1050,26 +1050,26 @@ dependencies = [
|
|
|
1050
1050
|
|
|
1051
1051
|
[[package]]
|
|
1052
1052
|
name = "pyo3-macros"
|
|
1053
|
-
version = "0.
|
|
1053
|
+
version = "0.30.1"
|
|
1054
1054
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1055
|
-
checksum = "
|
|
1055
|
+
checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
|
|
1056
1056
|
dependencies = [
|
|
1057
1057
|
"proc-macro2",
|
|
1058
1058
|
"pyo3-macros-backend",
|
|
1059
1059
|
"quote",
|
|
1060
|
-
"syn
|
|
1060
|
+
"syn 3.0.9",
|
|
1061
1061
|
]
|
|
1062
1062
|
|
|
1063
1063
|
[[package]]
|
|
1064
1064
|
name = "pyo3-macros-backend"
|
|
1065
|
-
version = "0.
|
|
1065
|
+
version = "0.30.1"
|
|
1066
1066
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1067
|
-
checksum = "
|
|
1067
|
+
checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
|
|
1068
1068
|
dependencies = [
|
|
1069
1069
|
"heck",
|
|
1070
1070
|
"proc-macro2",
|
|
1071
1071
|
"quote",
|
|
1072
|
-
"syn
|
|
1072
|
+
"syn 3.0.9",
|
|
1073
1073
|
]
|
|
1074
1074
|
|
|
1075
1075
|
[[package]]
|
|
@@ -7,7 +7,7 @@ repository = "https://github.com/2bndy5/git-bot-feedback"
|
|
|
7
7
|
license = "LGPL-3.0-or-later"
|
|
8
8
|
|
|
9
9
|
[workspace.dependencies]
|
|
10
|
-
pyo3 = { version = "0.
|
|
10
|
+
pyo3 = { version = "0.30.1", features = ["extension-module"] }
|
|
11
11
|
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
|
12
12
|
|
|
13
13
|
[workspace.dependencies.reqwest]
|
|
@@ -21,7 +21,7 @@ features = ["http2", "charset", "system-proxy"]
|
|
|
21
21
|
[package]
|
|
22
22
|
name = "git-bot-feedback"
|
|
23
23
|
description = "A library designed for CI tools that posts comments on a Pull Request."
|
|
24
|
-
version = "0.
|
|
24
|
+
version = "0.12.0"
|
|
25
25
|
edition.workspace = true
|
|
26
26
|
license.workspace = true
|
|
27
27
|
repository.workspace = true
|
|
@@ -51,9 +51,10 @@ The following is just a list of git servers that are planned (in order or priori
|
|
|
51
51
|
Gitea does not support
|
|
52
52
|
|
|
53
53
|
- posting thread comments for commits (push events)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
|
|
55
|
+
Deleting a PR review's individual comments
|
|
56
|
+
(see `ReviewOptions::delete_review_comments`) requires Gitea v1.25 or newer;
|
|
57
|
+
older versions only resolve them.
|
|
57
58
|
|
|
58
59
|
Only a repository admin can dismiss a PR review.
|
|
59
60
|
If the token's user is not an admin, outdated reviews can only be deleted
|
|
@@ -65,7 +66,7 @@ The following is just a list of git servers that are planned (in order or priori
|
|
|
65
66
|
which sets the `FORGEJO_ACTIONS` environment variable.
|
|
66
67
|
The token is read from the `GITEA_TOKEN` environment variable, or
|
|
67
68
|
the `FORGEJO_TOKEN` environment variable that the runner sets automatically.
|
|
68
|
-
Forgejo also does not support resolving a PR review's individual comments.
|
|
69
|
+
Forgejo also does not support resolving or deleting a PR review's individual comments.
|
|
69
70
|
- [ ] BitBucket
|
|
70
71
|
|
|
71
72
|
### Optional support
|
|
@@ -6,6 +6,39 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
<!-- markdownlint-disable MD024 -->
|
|
8
8
|
|
|
9
|
+
## [git-bot-feedback-py/v0.6.0] - 2026-11-06
|
|
10
|
+
|
|
11
|
+
### <!-- 1 --> 🚀 Added
|
|
12
|
+
|
|
13
|
+
- Add `RestApiClient::is_pr_same_remote()` by @2bndy5 in [#160](https://github.com/2bndy5/git-bot-feedback/pull/160)
|
|
14
|
+
- Add request, response, and error types by @2bndy5 in [#161](https://github.com/2bndy5/git-bot-feedback/pull/161)
|
|
15
|
+
|
|
16
|
+
### <!-- 4 --> 🛠️ Fixed
|
|
17
|
+
|
|
18
|
+
- Use the API root set by Gitea's runner and fill in missing methods by @shenxianpeng in [#162](https://github.com/2bndy5/git-bot-feedback/pull/162)
|
|
19
|
+
|
|
20
|
+
### <!-- 6 --> 📦 Dependency updates
|
|
21
|
+
|
|
22
|
+
- Bump version to git-bot-feedback/v0.12.0 by @2bndy5 in [`eae30be`](https://github.com/2bndy5/git-bot-feedback/commit/eae30be526aa3ee97954ab314a45b1569f2e3c7d)
|
|
23
|
+
|
|
24
|
+
### <!-- 9 --> 🗨️ Changed
|
|
25
|
+
|
|
26
|
+
- Eliminate fallback to "unknown" event name by @2bndy5 in [#164](https://github.com/2bndy5/git-bot-feedback/pull/164)
|
|
27
|
+
|
|
28
|
+
[git-bot-feedback-py/v0.6.0]: https://github.com/2bndy5/git-bot-feedback/compare/git-bot-feedback-py/v0.5.1...git-bot-feedback-py/v0.6.0
|
|
29
|
+
|
|
30
|
+
Full commit diff: [`git-bot-feedback-py/v0.5.1...git-bot-feedback-py/v0.6.0`][git-bot-feedback-py/v0.6.0]
|
|
31
|
+
|
|
32
|
+
## [git-bot-feedback-py/v0.5.1] - 2026-10-28
|
|
33
|
+
|
|
34
|
+
### <!-- 6 --> 📦 Dependency updates
|
|
35
|
+
|
|
36
|
+
- Bump version to git-bot-feedback-py/v0.5.1 by @2bndy5 in [`082c761`](https://github.com/2bndy5/git-bot-feedback/commit/082c76147cb01b032957a3a1b13b03fe8811e6a1)
|
|
37
|
+
|
|
38
|
+
[git-bot-feedback-py/v0.5.1]: https://github.com/2bndy5/git-bot-feedback/compare/git-bot-feedback-py/v0.5.0...git-bot-feedback-py/v0.5.1
|
|
39
|
+
|
|
40
|
+
Full commit diff: [`git-bot-feedback-py/v0.5.0...git-bot-feedback-py/v0.5.1`][git-bot-feedback-py/v0.5.1]
|
|
41
|
+
|
|
9
42
|
## [git-bot-feedback-py/v0.5.0] - 2026-10-27
|
|
10
43
|
|
|
11
44
|
### <!-- 1 --> 🚀 Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "git-bot-feedback-py"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
4
4
|
edition.workspace = true
|
|
5
5
|
license.workspace = true
|
|
6
6
|
repository.workspace = true
|
|
@@ -14,9 +14,9 @@ crate-type = ["cdylib"] # spell-checker: disable-line
|
|
|
14
14
|
path = "src/lib.rs"
|
|
15
15
|
|
|
16
16
|
[dependencies]
|
|
17
|
-
git-bot-feedback = { path = "../..", version = "0.
|
|
17
|
+
git-bot-feedback = { path = "../..", version = "0.12.0", features = ["file-changes", "pyo3"] }
|
|
18
18
|
pyo3 = { workspace = true }
|
|
19
|
-
pyo3-async-runtimes = { version = "0.
|
|
20
|
-
pyo3-log = "0.13.
|
|
19
|
+
pyo3-async-runtimes = { version = "0.30.0", features = ["tokio-runtime"] }
|
|
20
|
+
pyo3-log = "0.13.5"
|
|
21
21
|
reqwest = { workspace = true, features = ["default-tls"] }
|
|
22
22
|
tokio = { workspace = true }
|
|
@@ -6,6 +6,7 @@ from typing import NamedTuple
|
|
|
6
6
|
class GitClient:
|
|
7
7
|
def __init__(self) -> None: ...
|
|
8
8
|
def is_pr_event(self) -> bool: ...
|
|
9
|
+
def is_pr_same_remote(self) -> bool: ...
|
|
9
10
|
def is_debug_enabled(self) -> bool: ...
|
|
10
11
|
def start_log_group(self, name: str) -> None: ...
|
|
11
12
|
def end_log_group(self, name: str) -> None: ...
|
|
@@ -27,10 +28,47 @@ class GitClient:
|
|
|
27
28
|
self, output_variables: list[OutputVariable]
|
|
28
29
|
) -> None: ...
|
|
29
30
|
def write_file_annotations(self, annotations: list[FileAnnotation]) -> None: ...
|
|
31
|
+
async def send_api_request(self, request: Request) -> Response: ...
|
|
32
|
+
def try_next_page(self, headers: dict[str, str]) -> str | None: ...
|
|
30
33
|
@property
|
|
31
34
|
def client_kind(self) -> str: ...
|
|
35
|
+
@property
|
|
36
|
+
def api_url(self) -> str | None: ...
|
|
37
|
+
@property
|
|
38
|
+
def token_env_vars(self) -> list[str]: ...
|
|
32
39
|
def workspace_root(self) -> Path | None: ...
|
|
33
40
|
|
|
41
|
+
class Request:
|
|
42
|
+
url: str
|
|
43
|
+
method: str
|
|
44
|
+
headers: dict[str, str]
|
|
45
|
+
body: str | None
|
|
46
|
+
def __init__(
|
|
47
|
+
self,
|
|
48
|
+
url: str,
|
|
49
|
+
method: str = "GET",
|
|
50
|
+
headers: dict[str, str] | None = None,
|
|
51
|
+
body: str | None = None,
|
|
52
|
+
) -> None: ...
|
|
53
|
+
def set_token(self, token: str) -> None: ...
|
|
54
|
+
|
|
55
|
+
class Response:
|
|
56
|
+
@property
|
|
57
|
+
def status(self) -> int: ...
|
|
58
|
+
@property
|
|
59
|
+
def body(self) -> str: ...
|
|
60
|
+
@property
|
|
61
|
+
def headers(self) -> dict[str, str]: ...
|
|
62
|
+
|
|
63
|
+
class GitBotFeedbackError(Exception): ...
|
|
64
|
+
|
|
65
|
+
class RequestError(GitBotFeedbackError):
|
|
66
|
+
status: int | None
|
|
67
|
+
|
|
68
|
+
class RateLimitError(GitBotFeedbackError): ...
|
|
69
|
+
class ParseError(GitBotFeedbackError): ...
|
|
70
|
+
class EnvironmentError(GitBotFeedbackError): ...
|
|
71
|
+
|
|
34
72
|
class OutputVariable:
|
|
35
73
|
def __init__(self, name: str, value: str) -> None: ...
|
|
36
74
|
def validate(self) -> bool: ...
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
use pyo3::prelude::*;
|
|
2
|
+
mod py_types;
|
|
2
3
|
mod wrapper;
|
|
3
4
|
|
|
4
5
|
#[doc = include_str!("../README.rst")]
|
|
@@ -17,6 +18,21 @@ mod git_bot_feedback {
|
|
|
17
18
|
Ok(())
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
#[pymodule_export]
|
|
22
|
+
use super::py_types::EnvironmentError;
|
|
23
|
+
#[pymodule_export]
|
|
24
|
+
use super::py_types::GitBotFeedbackError;
|
|
25
|
+
#[pymodule_export]
|
|
26
|
+
use super::py_types::ParseError;
|
|
27
|
+
#[pymodule_export]
|
|
28
|
+
use super::py_types::PyRequest;
|
|
29
|
+
#[pymodule_export]
|
|
30
|
+
use super::py_types::PyResponse;
|
|
31
|
+
#[pymodule_export]
|
|
32
|
+
use super::py_types::RateLimitError;
|
|
33
|
+
#[pymodule_export]
|
|
34
|
+
use super::py_types::RequestError;
|
|
35
|
+
|
|
20
36
|
#[pymodule_export]
|
|
21
37
|
use super::wrapper::GitClient;
|
|
22
38
|
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
//! Python-aware types (requests, responses, and exceptions) used by the `GitClient` wrapper.
|
|
2
|
+
use std::{collections::HashMap, str::FromStr};
|
|
3
|
+
|
|
4
|
+
use ::git_bot_feedback::{RestClientError, client::RestApiRateLimitHeaders};
|
|
5
|
+
use pyo3::{create_exception, exceptions::PyException, exceptions::PyValueError, prelude::*};
|
|
6
|
+
use reqwest::{
|
|
7
|
+
Method, Url,
|
|
8
|
+
header::{AUTHORIZATION, HeaderMap, HeaderName, HeaderValue},
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
create_exception!(
|
|
12
|
+
git_bot_feedback,
|
|
13
|
+
GitBotFeedbackError,
|
|
14
|
+
PyException,
|
|
15
|
+
"The base class of all exceptions raised by this package."
|
|
16
|
+
);
|
|
17
|
+
create_exception!(
|
|
18
|
+
git_bot_feedback,
|
|
19
|
+
RequestError,
|
|
20
|
+
GitBotFeedbackError,
|
|
21
|
+
"Raised when an HTTP request could not be built or sent.\n\nThe ``status`` attribute is the HTTP status code, or ``None`` if there was no response."
|
|
22
|
+
);
|
|
23
|
+
create_exception!(
|
|
24
|
+
git_bot_feedback,
|
|
25
|
+
RateLimitError,
|
|
26
|
+
GitBotFeedbackError,
|
|
27
|
+
"Raised when a REST API's rate limit is exceeded."
|
|
28
|
+
);
|
|
29
|
+
create_exception!(
|
|
30
|
+
git_bot_feedback,
|
|
31
|
+
ParseError,
|
|
32
|
+
GitBotFeedbackError,
|
|
33
|
+
"Raised when data (diffs, headers, URLs, JSON, output variables) is malformed."
|
|
34
|
+
);
|
|
35
|
+
create_exception!(
|
|
36
|
+
git_bot_feedback,
|
|
37
|
+
EnvironmentError,
|
|
38
|
+
GitBotFeedbackError,
|
|
39
|
+
"Raised when the CI environment's event info or variables are missing or malformed."
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
fn request_error(msg: String, status: Option<u16>) -> PyErr {
|
|
43
|
+
let err = RequestError::new_err(msg);
|
|
44
|
+
Python::attach(|py| {
|
|
45
|
+
// Setting an attribute on a fresh exception instance cannot reasonably fail.
|
|
46
|
+
let _ = err.value(py).setattr("status", status); // spell-checker: disable-line
|
|
47
|
+
});
|
|
48
|
+
err
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// Convert a native error into the matching Python exception.
|
|
52
|
+
pub fn to_py_err(err: RestClientError) -> PyErr {
|
|
53
|
+
let msg = err.to_string();
|
|
54
|
+
match err {
|
|
55
|
+
RestClientError::Request(ref e) | RestClientError::RequestContext { source: ref e, .. } => {
|
|
56
|
+
request_error(msg, e.status().map(|s| s.as_u16()))
|
|
57
|
+
}
|
|
58
|
+
RestClientError::CannotCloneRequest => request_error(msg, None),
|
|
59
|
+
RestClientError::RateLimitNoReset
|
|
60
|
+
| RestClientError::RateLimitPrimary(_)
|
|
61
|
+
| RestClientError::RateLimitSecondary => RateLimitError::new_err(msg),
|
|
62
|
+
RestClientError::DiffError(_)
|
|
63
|
+
| RestClientError::InvalidHeaderValue(_)
|
|
64
|
+
| RestClientError::UnexpectedHeaderValue(_)
|
|
65
|
+
| RestClientError::HeaderParseInt(_)
|
|
66
|
+
| RestClientError::UrlParse(_)
|
|
67
|
+
| RestClientError::Json { .. }
|
|
68
|
+
| RestClientError::OutputVar(_) => ParseError::new_err(msg),
|
|
69
|
+
RestClientError::MalformedEventInfo(_) | RestClientError::EnvVar { .. } => {
|
|
70
|
+
EnvironmentError::new_err(msg)
|
|
71
|
+
}
|
|
72
|
+
_ => GitBotFeedbackError::new_err(msg),
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// The rate limit header names used by the given client kind.
|
|
77
|
+
pub fn rate_limit_headers(client_kind: &str) -> RestApiRateLimitHeaders {
|
|
78
|
+
let prefix = if client_kind == "gitlab" {
|
|
79
|
+
"ratelimit"
|
|
80
|
+
} else {
|
|
81
|
+
"x-ratelimit"
|
|
82
|
+
};
|
|
83
|
+
RestApiRateLimitHeaders {
|
|
84
|
+
reset: format!("{prefix}-reset"),
|
|
85
|
+
remaining: format!("{prefix}-remaining"),
|
|
86
|
+
retry: "retry-after".to_string(),
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/// The sensitive authentication header for the given client kind and token.
|
|
91
|
+
fn auth_header(client_kind: &str, token: &str) -> PyResult<Option<(HeaderName, HeaderValue)>> {
|
|
92
|
+
let (name, value) = match client_kind {
|
|
93
|
+
"gitlab" => (HeaderName::from_static("private-token"), token.to_string()),
|
|
94
|
+
"github" | "gitea" => (AUTHORIZATION, format!("token {token}")),
|
|
95
|
+
_ => return Ok(None),
|
|
96
|
+
};
|
|
97
|
+
let mut value =
|
|
98
|
+
HeaderValue::from_str(&value).map_err(|e| PyValueError::new_err(e.to_string()))?;
|
|
99
|
+
value.set_sensitive(true);
|
|
100
|
+
Ok(Some((name, value)))
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// The resolved pieces needed to build a native HTTP request.
|
|
104
|
+
pub struct RequestParts {
|
|
105
|
+
pub url: Url,
|
|
106
|
+
pub method: Method,
|
|
107
|
+
pub body: Option<String>,
|
|
108
|
+
pub headers: HeaderMap,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// An HTTP request to send using the client's connection.
|
|
112
|
+
///
|
|
113
|
+
/// Use :py:attr:`~git_bot_feedback.GitClient.api_url` to assemble the ``url``.
|
|
114
|
+
#[pyclass(module = "git_bot_feedback", name = "Request")]
|
|
115
|
+
#[derive(Clone)]
|
|
116
|
+
pub struct PyRequest {
|
|
117
|
+
/// The full URL to send the request to.
|
|
118
|
+
#[pyo3(get, set)]
|
|
119
|
+
pub url: String,
|
|
120
|
+
/// The HTTP method (case-insensitive).
|
|
121
|
+
#[pyo3(get, set)]
|
|
122
|
+
pub method: String,
|
|
123
|
+
/// The request headers. These override the client's default headers.
|
|
124
|
+
#[pyo3(get, set)]
|
|
125
|
+
pub headers: HashMap<String, String>,
|
|
126
|
+
/// The request body as text.
|
|
127
|
+
#[pyo3(get, set)]
|
|
128
|
+
pub body: Option<String>,
|
|
129
|
+
/// The authentication token; never exposed to Python.
|
|
130
|
+
token: Option<String>,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
#[pymethods]
|
|
134
|
+
impl PyRequest {
|
|
135
|
+
/// Create a request.
|
|
136
|
+
#[new]
|
|
137
|
+
#[pyo3(
|
|
138
|
+
signature = (url, method=String::from("GET"), headers=None, body=None),
|
|
139
|
+
text_signature = "(url: str, method: str = 'GET', headers: dict[str, str] | None = None, body: str | None = None)"
|
|
140
|
+
)]
|
|
141
|
+
pub fn new(
|
|
142
|
+
url: String,
|
|
143
|
+
method: String,
|
|
144
|
+
headers: Option<HashMap<String, String>>,
|
|
145
|
+
body: Option<String>,
|
|
146
|
+
) -> Self {
|
|
147
|
+
Self {
|
|
148
|
+
url,
|
|
149
|
+
method,
|
|
150
|
+
headers: headers.unwrap_or_default(),
|
|
151
|
+
body,
|
|
152
|
+
token: None,
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/// Set the authentication token to send with this request.
|
|
157
|
+
///
|
|
158
|
+
/// The client adds the token as a sensitive header with the name its git server expects,
|
|
159
|
+
/// replacing any header of the same name in ``headers``.
|
|
160
|
+
/// Use :py:attr:`~git_bot_feedback.GitClient.token_env_vars` to find the token's variable.
|
|
161
|
+
#[pyo3(signature = (token), text_signature = "(token: str) -> None")]
|
|
162
|
+
pub fn set_token(&mut self, token: String) {
|
|
163
|
+
self.token = Some(token);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
impl PyRequest {
|
|
168
|
+
/// Validate and resolve this request.
|
|
169
|
+
///
|
|
170
|
+
/// The token (if set) is added as a sensitive header for the given `client_kind`.
|
|
171
|
+
pub fn resolve(&self, client_kind: &str) -> PyResult<RequestParts> {
|
|
172
|
+
let url = Url::parse(&self.url)
|
|
173
|
+
.map_err(|e| PyValueError::new_err(format!("Invalid URL '{}': {e}", self.url)))?;
|
|
174
|
+
|
|
175
|
+
let method = Method::from_str(&self.method.to_uppercase())
|
|
176
|
+
.map_err(|e| PyValueError::new_err(format!("Invalid method '{}': {e}", self.method)))?;
|
|
177
|
+
|
|
178
|
+
let mut headers = HeaderMap::new();
|
|
179
|
+
for (k, v) in &self.headers {
|
|
180
|
+
let name = HeaderName::from_str(k)
|
|
181
|
+
.map_err(|e| PyValueError::new_err(format!("Invalid header name '{k}': {e}")))?;
|
|
182
|
+
let value =
|
|
183
|
+
HeaderValue::from_str(v).map_err(|e| PyValueError::new_err(e.to_string()))?;
|
|
184
|
+
headers.insert(name, value);
|
|
185
|
+
}
|
|
186
|
+
if let Some(token) = &self.token
|
|
187
|
+
&& let Some((name, value)) = auth_header(client_kind, token)?
|
|
188
|
+
{
|
|
189
|
+
headers.insert(name, value);
|
|
190
|
+
}
|
|
191
|
+
Ok(RequestParts {
|
|
192
|
+
url,
|
|
193
|
+
method,
|
|
194
|
+
body: self.body.clone(),
|
|
195
|
+
headers,
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/// The response of an HTTP request.
|
|
201
|
+
#[pyclass(module = "git_bot_feedback", name = "Response", frozen, get_all)]
|
|
202
|
+
#[derive(Clone, Debug)]
|
|
203
|
+
pub struct PyResponse {
|
|
204
|
+
/// The HTTP status code.
|
|
205
|
+
pub status: u16,
|
|
206
|
+
/// The response body as text.
|
|
207
|
+
pub body: String,
|
|
208
|
+
/// The response headers (names are lowercase).
|
|
209
|
+
pub headers: HashMap<String, String>,
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
impl PyResponse {
|
|
213
|
+
pub async fn from_reqwest(response: reqwest::Response) -> Result<Self, RestClientError> {
|
|
214
|
+
let status = response.status().as_u16();
|
|
215
|
+
let headers = response
|
|
216
|
+
.headers()
|
|
217
|
+
.iter()
|
|
218
|
+
.map(|(k, v)| {
|
|
219
|
+
(
|
|
220
|
+
k.to_string(),
|
|
221
|
+
String::from_utf8_lossy(v.as_bytes()).into_owned(),
|
|
222
|
+
)
|
|
223
|
+
})
|
|
224
|
+
.collect();
|
|
225
|
+
let body = response.text().await?;
|
|
226
|
+
Ok(Self {
|
|
227
|
+
status,
|
|
228
|
+
body,
|
|
229
|
+
headers,
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
}
|