Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple context-awareness using job name #212

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,17 @@ public void createCommitStatus(String sha1, GHCommitState state, String url, Str
public void createCommitStatus(AbstractBuild<?, ?> build, String sha1, GHCommitState state, String url, String message, int id) {
logger.log(Level.INFO, "Setting status of {0} to {1} with url {2} and message: {3}", new Object[]{sha1, state, url, message});
try {
ghRepository.createCommitStatus(sha1, state, url, message);
String context = build.getParent().getDisplayName();
if (context == null) {
context = "";
}
context = context.replaceAll("\\W+", "_").replaceAll("^_", "").replaceAll("_$", "");
if (context.isEmpty()) {
context = "default";
} else{
context = "ghprb_" + context;
}
ghRepository.createCommitStatus(sha1, state, url, message, context);
} catch (IOException ex) {
if (GhprbTrigger.getDscp().getUseComments()) {
logger.log(Level.INFO, "Could not update commit status of the Pull Request on GitHub. Trying to send comment.", ex);
Expand Down