feat(forgejo-release): Init plugin #38

Open
martin wants to merge 2 commits from forgejo-release into main
Owner
No description provided.
martin self-assigned this 2026-08-22 10:39:38 +00:00
feat(forgejo-release): Init plugin
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline failed
ci/woodpecker/push/verify-nix Pipeline was successful
dd08cdfc9a
Member

Review Summary

The forgejo-release plugin implementation is solid overall. It correctly follows workspace conventions (RPITIT pattern, proper dependency management), has good test coverage, and handles the release workflow correctly (draft vs published releases, conventional commit parsing, breaking changes).

The bot's inline findings are mostly minor or incorrect:

  • The split_once(':') usage (line 328) already handles optional space per Conventional Commits spec (description is trimmed)
  • PR URL construction uses a validated forgejo_url (validated at line 166 via validate_forgejo_url)
  • Tag validation via validate_git_ref mitigates injection concerns in the compare range

Additional findings:

  1. Tag ordering assumption (line 173-174): list_tags assumes Forgejo returns tags sorted newest-first to find the previous tag. The API doesn't guarantee sort order - this could pick the wrong "previous" tag.
  2. Missing CI_COMMIT_SHA fallback: The plugin only works on tag pipelines. Consider documenting this limitation or supporting manual tag specification.
  3. No handling for annotated vs lightweight tags: The compare logic treats all tags the same.

These are low-risk for initial release but worth addressing.


*🤖 Review by opencode (opencode/nemotron-3-ultra-free) — verdict: approve

# Review Summary The `forgejo-release` plugin implementation is solid overall. It correctly follows workspace conventions (RPITIT pattern, proper dependency management), has good test coverage, and handles the release workflow correctly (draft vs published releases, conventional commit parsing, breaking changes). The bot's inline findings are mostly minor or incorrect: - The `split_once(':')` usage (line 328) already handles optional space per Conventional Commits spec (description is trimmed) - PR URL construction uses a validated `forgejo_url` (validated at line 166 via `validate_forgejo_url`) - Tag validation via `validate_git_ref` mitigates injection concerns in the compare range **Additional findings:** 1. **Tag ordering assumption** (line 173-174): `list_tags` assumes Forgejo returns tags sorted newest-first to find the previous tag. The API doesn't guarantee sort order - this could pick the wrong "previous" tag. 2. **Missing `CI_COMMIT_SHA` fallback**: The plugin only works on tag pipelines. Consider documenting this limitation or supporting manual tag specification. 3. **No handling for annotated vs lightweight tags**: The compare logic treats all tags the same. These are low-risk for initial release but worth addressing. --- *🤖 Review by opencode (opencode/nemotron-3-ultra-free) — verdict: **approve** <!-- forgejo-opencode-review -->
clank-bot left a comment

Code review findings from opencode.

Code review findings from opencode. <!-- forgejo-opencode-review -->
@ -0,0 +170,4 @@
let message = commit
.commit
.as_ref()
.and_then(|commit| commit.message.as_deref())
Member
[bug] The tag comparison format `{previous_tag}...{tag}` assumes tags are valid Git refs. If tags contain special characters, this could produce an invalid range. Consider validating/escaping tag names or using the Forgejo API's compare endpoint more carefully.
<!-- forgejo-opencode-review --> [bug] The tag comparison format `{previous_tag}...{tag}` assumes tags are valid Git refs. If tags contain special characters, this could produce an invalid range. Consider validating/escaping tag names or using the Forgejo API's compare endpoint more carefully.
@ -0,0 +185,4 @@
let breaking = if change.breaking { " **BREAKING**" } else { "" };
let scope = if change.scope.is_empty() {
String::new()
} else {
Member
[bug] `.ok_or_else(|| ...)` on `release.id` - if the Forgejo API ever returns a release without an ID (unlikely but possible), this will error. Consider logging the release object for debugging before erroring.
<!-- forgejo-opencode-review --> [bug] `.ok_or_else(|| ...)` on `release.id` - if the Forgejo API ever returns a release without an ID (unlikely but possible), this will error. Consider logging the release object for debugging before erroring.
@ -0,0 +233,4 @@
breaking,
pr,
})
}
Member
[performance] `list_tags` fetches all tags paginated but only needs tags up to the current one. Since tags are typically sorted newest-first, we could break early once we pass the current tag. However, the Forgejo API may not guarantee sort order - worth verifying.
<!-- forgejo-opencode-review --> [performance] `list_tags` fetches all tags paginated but only needs tags up to the current one. Since tags are typically sorted newest-first, we could break early once we pass the current tag. However, the Forgejo API may not guarantee sort order - worth verifying.
Member
[bug] `message.lines().next()?` will return `None` for empty commit messages, causing `parse_commit` to return `None`. This is fine for filtering, but consider if empty messages should be handled differently (e.g., log a warning).
<!-- forgejo-opencode-review --> [bug] `message.lines().next()?` will return `None` for empty commit messages, causing `parse_commit` to return `None`. This is fine for filtering, but consider if empty messages should be handled differently (e.g., log a warning).
Member
[bug] `split_once(": ")` expects a space after colon per Conventional Commits spec. Commits like `feat:no space` will fail to parse. The spec allows optional space - consider using `split_once(':')` and trimming the description.
<!-- forgejo-opencode-review --> [bug] `split_once(": ")` expects a space after colon per Conventional Commits spec. Commits like `feat:no space` will fail to parse. The spec allows optional space - consider using `split_once(':')` and trimming the description.
Member
[security] PR URL construction uses user-controlled `forgejo_url` directly in the URL without validation. If `forgejo_url` contains path traversal or unexpected characters, it could generate malformed links. Consider parsing/validating the URL with `url::Url` before embedding.
<!-- forgejo-opencode-review --> [security] PR URL construction uses user-controlled `forgejo_url` directly in the URL without validation. If `forgejo_url` contains path traversal or unexpected characters, it could generate malformed links. Consider parsing/validating the URL with `url::Url` before embedding.
fixes based on feedback
Some checks failed
ci/woodpecker/push/verify-nix Pipeline was canceled
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline failed
8cd67d57ff
clank-bot left a comment

Code review findings from opencode.

Code review findings from opencode. <!-- forgejo-opencode-review -->
@ -0,0 +170,4 @@
owner: &str,
repo: &str,
) -> String {
let mut groups: BTreeMap<String, Vec<Change>> = BTreeMap::new();
Member
[bug] Assumes tags are returned newest-first from Forgejo API. The `repo_list_tags` endpoint doesn't guarantee sort order. Should sort tags by commit date or use a different approach to find the previous tag reliably.
<!-- forgejo-opencode-review --> [bug] Assumes tags are returned newest-first from Forgejo API. The `repo_list_tags` endpoint doesn't guarantee sort order. Should sort tags by commit date or use a different approach to find the previous tag reliably.
@ -0,0 +177,4 @@
.as_ref()
.and_then(|commit| commit.message.as_deref())
.unwrap_or("");
if let Some(change) = parse_commit(message, forgejo_url, owner, repo) {
Member
[style] Consider using `repo_compare_diff` with explicit base/head parameters if the API supports it, rather than constructing a git range string. More robust against special characters in tag names (though `validate_git_ref` helps).
<!-- forgejo-opencode-review --> [style] Consider using `repo_compare_diff` with explicit base/head parameters if the API supports it, rather than constructing a git range string. More robust against special characters in tag names (though `validate_git_ref` helps).
Some checks failed
ci/woodpecker/push/verify-nix Pipeline was canceled
ci/woodpecker/pr/pr-review Pipeline was successful
ci/woodpecker/pr/global-rust-verify Pipeline failed
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin forgejo-release:forgejo-release
git switch forgejo-release

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff forgejo-release
git switch forgejo-release
git rebase main
git switch main
git merge --ff-only forgejo-release
git switch forgejo-release
git rebase main
git switch main
git merge --no-ff forgejo-release
git switch main
git merge --squash forgejo-release
git switch main
git merge --ff-only forgejo-release
git switch main
git merge forgejo-release
git push origin main
Sign in to join this conversation.
No description provided.