Documentation
¶
Index ¶
- func CommitsHandler(w http.ResponseWriter, r *http.Request)
- func FetchCommit(repo, gitRef string) (*github.RepositoryCommit, error)
- func FetchLatestCommit(repo string) (*github.RepositoryCommit, error)
- func GenerateAuthToken(repo string) string
- func GenerateJWT(privateKey *rsa.PrivateKey) (string, error)
- func GetInstallationToken(jwtToken string, repo string) (string, error)
- func LoadPrivateKey(filePath string) (*rsa.PrivateKey, error)
- func NewGithubClient(repo string) *github.Client
- func ReleasesHandler(w http.ResponseWriter, r *http.Request)
- type ErrorResponse
- type MergedCommits
- type MergedReleases
- type Release
- type StandardizedEntity
- type StandardizedOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitsHandler ¶
func CommitsHandler(w http.ResponseWriter, r *http.Request)
CommitsHandler handles the API endpoint for fetching the latest and current commits
func FetchCommit ¶
func FetchCommit(repo, gitRef string) (*github.RepositoryCommit, error)
FetchCommit fetches a specific commit by its Git reference
func FetchLatestCommit ¶
func FetchLatestCommit(repo string) (*github.RepositoryCommit, error)
FetchLatestCommit fetches the latest commit from the repository
func GenerateAuthToken ¶
func GenerateJWT ¶
func GenerateJWT(privateKey *rsa.PrivateKey) (string, error)
GenerateJWT generates a JWT for the GitHub App
func GetInstallationToken ¶
GetInstallationToken fetches an Installation Access Token
func LoadPrivateKey ¶
func LoadPrivateKey(filePath string) (*rsa.PrivateKey, error)
LoadPrivateKey loads the RSA private key from the file
func NewGithubClient ¶
func ReleasesHandler ¶
func ReleasesHandler(w http.ResponseWriter, r *http.Request)
ReleasesHandler handles the API endpoint for fetching releases from target repositories
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse represents an error message
type MergedCommits ¶
type MergedCommits struct {
Latest *github.RepositoryCommit `json:"latest"`
Current *github.RepositoryCommit `json:"current"`
}
type MergedReleases ¶
type StandardizedEntity ¶
type StandardizedEntity struct {
Ref string `json:"ref"` // Commit SHA or Release Tag
URL string `json:"url"` // Commit URL or Release URL
Message string `json:"message"` // Commit Message or Release Body
Author string `json:"author"` // Commit Author Login or Release Author Login
PublishedAt string `json:"published_at"` // Commit Date or Release Published At
}
func StandardizeCommit ¶
func StandardizeCommit(commit *github.RepositoryCommit) *StandardizedEntity
StandardizeCommit converts a RepositoryCommit into a StandardizedEntity
func StandardizeRelease ¶
func StandardizeRelease(release *github.RepositoryRelease) *StandardizedEntity
StandardizeRelease converts a Release into a StandardizedEntity
type StandardizedOutput ¶
type StandardizedOutput struct {
Latest *StandardizedEntity `json:"latest"`
Current *StandardizedEntity `json:"current"`
}
Create a standardized struct for Commits and Releases
func FetchCommits ¶
func FetchCommits(repo, gitRef string) (*StandardizedOutput, int, error)
FetchCommits fetches both the latest commit and the one matching the Git reference (gitRef)
func FetchReleases ¶
func FetchReleases(repo, gitRef string) (*StandardizedOutput, error)