-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major
-
Component/s: github-api-plugin
-
None
-
Environment:Production
Hello Team,
I am using that API for download file from Github repository then update file content then push that file. Created Jenkins library and call the function from Jenkins job. Â
Following are the code that using for get file then update and push. Â
Â
def repository = new GithubBuilder() .build(githubCredential) .getRepository(pullRequestInfo.repositoryFullName) GHContent ghContent = repository.getFileContent(filePath, pullRequestInfo.branchName) if(!repository.branches.find { Map.Entry entry -> entry.key == pullRequestInfo.branchName}) { echo "branch ${pullRequestInfo.branchName} DOES NOT exist" log.info("Branch ${pullRequestInfo.branchName} does not exist") } else { echo "branch ${pullRequestInfo.branchName} exist" log.info("Using branch ${pullRequestInfo.branchName}") repository.createContent() .path(ghContent.path) .content(fileContent) .branch(pullRequestInfo.branchName) .message(commitMessage) .sha(ghContent.sha) .commit() log.info("File ${ghContent.path} updated on branch ${pullRequestInfo.branchName}") }
Â
Â
But some time it's failed with following error.Â
hudson.remoting.ProxyException: org.kohsuke.github.HttpException: {"message":"xxxxx/xxxxxx/terraform.tfvars does not match de388744f1563ba424e35610156bdda5aef2a8b5","documentation_url":"https://docs.github.com/rest/repos/contents#create-or-update-file-contents"} at org.kohsuke.github.GitHubConnectorResponseErrorHandler$1.onError(GitHubConnectorResponseErrorHandler.java:56) at org.kohsuke.github.GitHubClient.detectKnownErrors(GitHubClient.java:424) ...
...
....
Could not update commit status. Message: {"message":"Validation Failed","errors":[{"resource":"Status","code":"custom","message":"This SHA and context has reached the maximum number of statuses."}],"documentation_url":"https://docs.github.com/rest/commits/statuses#create-a-commit-status"}
Could you please help me what there is wrong. Following are the versions that I am using.
github-api - 1.301-378.v9807bd746da5
org.kohsuke - 1.301
–
Thanks
Ravi