Upload of change log to GitHub fails
Closed this issue · 3 comments
The upload of the change log to GitHub fails frequently with
{"message":"Validation Failed","errors":[{"resource":"Release","code":"custom","message":"Published releases must have a valid tag"}],"documentation_url":"https://developer.github.com/v3/repos/releases/#create-a-release"}
Expected: HTTP response with status 201
but: was <422 Unprocessable Entity [https://api.github.com/repos/tschulte/gradle-semantic-release-plugin/releases]
I think this is a timing issue. The tag is created and pushed to GitHub. Upload of the change log to GitHub using the Rest-API does require the existence of the tag. Maybe the API caches the tags.
One possible solution might be to first poll the tags using the API after creating and pushing the tag.
I have created a test project https://github.com/tschulte/github-releasetest with corresponding travis job https://travis-ci.org/tschulte/github-releasetest/. With that project, upload of the releasenotes does work OK every time.
Not reproducible any more.
Now the problem happens sometime in the test project. E.g. https://travis-ci.org/tschulte/github-releasetest/builds/80699738
:release
Executing task ':release' (up-to-date check took 0.001 secs) due to:
Task has not declared any outputs.
Tagging repository as v2.2.1
Pushing changes in [refs/heads/master, v2.2.1] to origin
The following authentication options are allowed (though they may not be available): [INTERACTIVE, PAGEANT, SSHAGENT, HARDCODED]
using hardcoded credentials from system properties
jcabi-aspects 0.20.1/f0aff93 started new daemon thread jcabi-loggable for watching of @Loggable annotated methods
#fetch(POST api.github.com /repos/tschulte/github-releasetest/releases): [422 Unprocessable Entity] in 676ms
#create('v2.2.1'): thrown java.lang.AssertionError(HTTP response status is not equal to 201:
422 Unprocessable Entity [https://api.github.com/repos/tschulte/github-releasetest/releases]
Server: GitHub.com
Date: Wed, 16 Sep 2015 19:11:02 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 221
Status: 422 Unprocessable Entity
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4986
X-RateLimit-Reset: 1442433476
X-OAuth-Scopes: public_repo
X-Accepted-OAuth-Scopes:
X-GitHub-Media-Type: github.v3
X-XSS-Protection: 1; mode=block
X-Frame-Options: deny
Content-Security-Policy: default-src 'none'
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 3400F07A:0948:11BDCED:55F9BEC6
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
{"message":"Validation Failed","errors":[{"resource":"Release","code":"custom","message":"Published releases must have a valid tag"}],"documentation_url":"https://developer.github.com/v3/repos/releases/#create-a-release"}
Expected: HTTP response with status 201
but: was <422 Unprocessable Entity [https://api.github.com/repos/tschulte/github-releasetest/releases]
Server: GitHub.com
Date: Wed, 16 Sep 2015 19:11:02 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 221
Status: 422 Unprocessable Entity
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4986
X-RateLimit-Reset: 1442433476
X-OAuth-Scopes: public_repo
X-Accepted-OAuth-Scopes:
X-GitHub-Media-Type: github.v3
X-XSS-Protection: 1; mode=block
X-Frame-Options: deny
Content-Security-Policy: default-src 'none'
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 3400F07A:0948:11BDCED:55F9BEC6
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
{"message":"Validation Failed","errors":[{"resource":"Release","code":"custom","message":"Published releases must have a valid tag"}],"documentation_url":"https://developer.github.com/v3/repos/releases/#create-a-release"}>) out of org.hamcrest.MatcherAssert#assertThat[20] in 721ms
:release FAILED