feat(webhook): add Forgejo CLI setup#2764
Conversation
|
|
There was a problem hiding this comment.
Code Review
This pull request adds support for configuring Forgejo webhooks via the CLI, including updated documentation, a new forgejoConfig implementation, and corresponding unit tests. Feedback points out that parsing SSH repository URLs in forgejoInstanceURL can cause an error that blocks the setup process, and suggests ignoring the error to gracefully fall back to an empty default URL.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| defaultURL, err := forgejoInstanceURL(repoURL) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
If the repository URL is an SSH URL (e.g., git@forgejo.example.com:owner/repo.git), forgejoInstanceURL will return an error because it cannot parse the scheme and host. Returning this error immediately blocks the user from proceeding with the CLI setup.
Instead of returning the error and aborting, we should handle it gracefully by falling back to an empty default URL so the user can still manually input their Forgejo URL.
| defaultURL, err := forgejoInstanceURL(repoURL) | |
| if err != nil { | |
| return err | |
| } | |
| defaultURL, _ := forgejoInstanceURL(repoURL) |
There was a problem hiding this comment.
Will look into this and amend the commit!
There was a problem hiding this comment.
Okay this is interesting feedback because ssh urls are not even supported by the admission webhook:
Error: admission webhook "validation.pipelinesascode.tekton.dev" denied the request: URL scheme must be http or https
This error with the admission webhook hits before we even get to this line.
2fe600d to
ffd287b
Compare
|
/ok-to-test |
ffd287b to
d0cd587
Compare
| case strings.Contains(url, "bitbucket-cloud"): | ||
| providerName = "bitbucket-cloud" | ||
| case strings.Contains(url, "forgejo"): | ||
| providerName = "forgejo" |
There was a problem hiding this comment.
not something you need to address but I think GetProviderName is very fragile with hosted instance, names can be anything...
There was a problem hiding this comment.
100% agree. Just couldn't think of any other "definitive" signal here.
a2afb61 to
4eef949
Compare
Support Forgejo in the CLI webhook setup path for `tkn pac create repo` and `tkn pac webhook add`. This lets users create the Repository CR, secret, and Forgejo webhook through the same flow as the other supported webhook providers. Use the existing vendored Forgejo SDK, configure the Forgejo events that Pipelines-as-Code already handles, and document the token requirements for CLI setup. Fixes tektoncd#2755. Co-Authored-By: GPT 5.5 <codex@openai.com> Signed-off-by: Katie Mulliken <mulliken@redhat.com>
4eef949 to
a6e6012
Compare
📝 Description of the Change
Adds Forgejo to the CLI webhook setup path used by
tkn pac create repoandtkn pac webhook add.This PR:
forgejoto webhook provider selection and detectionpush,pull_request, andissue_comment🔗 Linked GitHub Issue
Fixes #2755
🧪 Testing Strategy
Ran:
🤖 AI Assistance
AI assistance can be used for various tasks, such as code generation,
documentation, or testing.
Please indicate whether you have used AI assistance
for this PR and provide details if applicable.
Used AI assistance to help implement the Forgejo CLI webhook setup, tests, docs, and PR preparation. I reviewed the generated code and ran the local checks listed above.
Important
Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ Submitter Checklist
fix:orfeat:, matches the Type of Change I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.