Skip to main content

Crate git_bot_feedback

Crate git_bot_feedback 

Source
Expand description

§Git-bot-feedback

rust-ci-badge docs-rs-badge codecov-badge crates-io-badge GitHub License

A rust library 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

§Optional Features

These cargo features are optional and disabled by default:

  • file-changes: ability to list files changed with information like which lines have additions or which lines are shown in the diff.

§TLS Backend

A TLS backend is explicitly not set by this crate. This is intended to allow library consumers to choose the TLS backend of their choice; see reqwest’s features.

§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

  • 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.
  • BitBucket

§Optional support

Each supported implementation of the above git servers can be controlled via cargo features. They are enabled by default.

  • github enables support of GitHub implementation
  • gitea enables support of Gitea implementation

§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)

Re-exports§

pub use client::RestApiClient;
pub use client::RestApiRateLimitHeaders;
pub use error::RestClientError;
pub use fast_glob;file-changes
pub use regex;file-changes

Modules§

client
A module to contain traits and structs that are needed by the rest of the git-bot-feedback crate’s API.
error
Error types used across the git-bot-feedback crate.

Structs§

DiffHunkHeaderfile-changes
A struct to represent the header information of a diff hunk.
FileAnnotation
A structure to describe the output of a file annotation.
FileDiffLinesfile-changes
A structure to represent a file’s changes per line numbers.
FileFilterfile-changes
A structure to encapsulate file path filtering behavior.
OutputVariable
A type to represent an output variable.
ReviewComment
A struct to describe a single comment in a Pull Request review.
ReviewOptions
A struct to describe a Pull Request review.
ThreadCommentOptions
Options that control posting comments on a thread.

Enums§

AnnotationLevel
The severity of a FileAnnotation.
CommentKind
An enumeration of possible type of comments being posted.
CommentPolicy
An enumeration of supported behaviors about posting comments.
LinesChangedOnlyfile-changes
An enum to help determine what constitutes a changed file based on the diff contents.
ReviewAction
An enumeration of possible recommended actions for a Pull Request review.

Functions§

parse_difffile-changes
Parses a git diff string into a map of file names to their corresponding FileDiffLines.