Skip setting PR status post-build if not a PR?
I'm trying to configure a job that builds pull requests and also master branch. I have set Set status before build and also the post-build action to GitHub PR: set PR status. This works for pull requests. But it will fail when I manually build or trigger on master branch with the following:
ERROR: Build step failed with exception
java.lang.NullPointerException
at org.jenkinsci.plugins.github.pullrequest.publishers.impl.GitHubPRBuildStatusPublisher.perform(GitHubPRBuildStatusPublisher.java:95)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
at hudson.model.Run.execute(Run.java:1881)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Build step 'GitHub PR: set PR status' marked build as failure
Finished: FAILURE
I suspect because there is no pull request it fails to set the status. Is there a way to ignore or skip this for non-pull requests?
Today I was running into the same issue. It looks like it's on purpose, that Post-build actions fail on manually triggered jobs. If this is expected, I would recommend to add it to the FAQ. What do you think @KostyaSha? Is there a plan to support manually triggered jobs in the future?
Same question as in https://github.com/KostyaSha/github-integration-plugin/issues/268