Class StatusToGithub
java.lang.Object
com.group8.StatusToGithub
Client for interacting with the GitHub Commit Status API (P3).
It reads a personal access token from the GH_TOKEN environment
variable and exposes convenience methods to get and set the status of a
commit in a given repository.
-
Constructor Summary
ConstructorsConstructorDescriptionStatusToGithub(String owner, String repo) Creates a status client for the given repository using the defaultHttpClientWrapperimplementation. -
Method Summary
Modifier and TypeMethodDescriptiongetCommitStatus(String sha) Retrieves commit status from GitHub for the given SHA.static voidbooleansetCommitStatus(String sha, String state) Sets the commit status for the given SHA.
-
Constructor Details
-
StatusToGithub
Creates a status client for the given repository using the defaultHttpClientWrapperimplementation.- Parameters:
owner- repository owner (user or organisation)repo- repository name
-
-
Method Details
-
getCommitStatus
-
setCommitStatus
Sets the commit status for the given SHA.- Parameters:
sha- Git commit SHA to annotatestate- desired status ("error","failure","pending"or"success")- Returns:
trueif GitHub accepted the status (HTTP 201),falseotherwise or when the state is invalid
-
main
-