Codeship CI_REPO_NAME not accurate
https://github.com/danger/danger-js/blob/48ab882843f30f9fee8a9cbf48155307f5609f52/source/ci_source/providers/Codeship.ts#L68
The CI_REPO_NAME env var only contains the project name and not the user / organization. We are using Codeship Pro. Not sure if Basic has different results. This causes the API requests such as https://api.github.com/repos/REPO_NAME_HERE/pulls to fail with 404 status. Example:
Request failed [404]: https://api.github.com/repos/gourami/pulls
Response: {
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3/repos/#get"
}
We tried doing a printenv and could not find a Codeship env var which contained the complete name e.g. Organization/Repository, so I'm not sure how to globally fix this.
We are resorting to overriding the CI_REPO_NAME env var inline when calling danger script.
Thanks will keep this open, might be worth raising an issue with them about making something available
I opened a support ticket with Codeship and will report back here upon response.
Hey Mark, Thanks for your feature request for CodeShip!I have shared this request for enhancement with our product team as a formal request so they are aware of this as well. As a note, we cannot currently offer any timeline guarantees for requests for features to be included in CodeShip.In the meantime since this isn't currently available I would recommend just running a command to try and retrieve the information you are looking for from the configured GitHub repo in your app.Please let us know if you have any other questions. Best regards
Sounds like we'll be hardcoding CI_REPO_NAME in the meantime
Hey Mark, Product has decided that this will be in the backlog for now so I would recommend sticking with a work around. Also you can follow along at: https://changelog.codeship.com for any changes to our system. Best regards
RIP
If this helps anyone, I was able to write this command which works for me locally at least. Haven't tried it from within a Codeship Pro docker container yet tho — Idk if the git config would be different in there.
▶ git config --get remote.origin.url
# => https://github.com/Vydia/gourami.git
▶ git config --get remote.origin.url | sed 's/.*\/\([^ ]*\/[^.]*\).*/\1/' # Capture last 2 path segments before the dot in .git
# => Vydia/gourami
This is the desired result as Vydia is the organization name and gourami is the package name. Combined they can help form the complete CI_REPO_NAME