git-bot-feedback¶
A Python library (written in Rust) designed for CI tools to easily submit feedback on a git server.
Feedback on a git server using this library can be in the form of
thread comments (for a PR or commit)
setting output variables for other CI tools to consume
append a summary comment to a CI workflow run’s summary page
mark the start and end of a group of log statements (in the CI workflow run’s logs)
files annotations
Pull Request reviews
get a list of changed files in a PR or commit (including line numbers shown in the diff)
This uses async functions to access network resources. Thus, an asyncio event
loop is required.
Supported git servers¶
This project is designed to easily add support for various git servers. The following is just a list of git servers that are planned (in order or priority).
GitHub
GitLab
GitLab support requires GitLab v17.9 or newer and a
GITLAB_TOKENenvironment variable (an access token). See GitLab token permissions for the permissions each feature needs. GitLab does not supportposting thread comments for commits (push events)
output variables and step summaries (output variables are only logged)
hiding outdated PR review summary comments
Gitea
Gitea does not support
posting thread comments for commits (push events)
programmatically deleting a PR reviews’ individual comments, rather we can only resolve them (currently). However, deleting an entire PR review is supported.
Only a repository admin can dismiss a PR review. If the token’s user is not an admin, outdated reviews can only be deleted (see
ReviewOptions.delete_review_comments).Forgejo
Forgejo uses the Gitea implementation, so the same limitations apply. Forgejo support requires Forgejo Runner v7.0.0 or newer, which sets the
FORGEJO_ACTIONSenvironment variable. The token is read from theGITEA_TOKENenvironment variable, or theFORGEJO_TOKENenvironment variable that the runner sets automatically. Forgejo also does not support resolving a PR review’s individual comments.BitBucket
Currently, only GitHub, GitLab, Gitea, and Forgejo are supported.
LGPL license¶
This project is licensed under LGPL-3.0-or-later.
Since this library ultimately requires write access to users’ projects (to allow posting comments), it could easily be modified with malicious intent.
By using the LGPL-3.0-or-later license, we can offer some assurance and help safeguard end-users’ data/privacy because the following conditions must be met:
the source code is publicly available
any redistributed forms must state their modifications (if any)
- API
- Git Client
GitClientGitClient.api_urlGitClient.append_step_summary()GitClient.client_kindGitClient.cull_pr_reviews()GitClient.end_log_group()GitClient.event_nameGitClient.get_list_of_changed_files()GitClient.is_debug_enabled()GitClient.is_pr_event()GitClient.is_pr_same_remote()GitClient.post_pr_review()GitClient.post_thread_comment()GitClient.send_api_request()GitClient.set_user_agent()GitClient.start_log_group()GitClient.token_env_varsGitClient.try_next_page()GitClient.workspace_root()GitClient.write_file_annotations()GitClient.write_output_variables()
nearest_git_root()
- HTTP Requests
- Errors
- Thread Comments
- Pull Request Reviews
- File Annotations
- Output Variables
- File Changes
- Git Client