Using “no-api” key on Github Forked Repository in Composer repositories configuration for Travis Build
So, you’re doing a pull request, you want the feature to be merged so bad to public repository, but for whatever reason, it is not merged yet. You can register your forked repository under composer “repositories” config:
{ "require": { "awesome/library": "dev-my-fork-awesome-feature" }, "repositories" : [ { "type" : "vcs", "url" : "https://github.com/yourgithubuser/library" } ] }
That will work for your local dev and your server, but unfortunatelly, that won’t work on Travis! We will get the following error:
Failed to clone the git@github.com:yourgithubuser/library.git repository, try running in interactive mode so that you can enter your GitHub credentials [RuntimeException] Failed to execute git clone --mirror 'git@github.com:yourgithubuser/library.git' '/home/travis/.composer/cache/vcs/git-github.com-yourgithubuser-library.git/'
To make that work, we will need the “no-api” key in your composer.json under the per-repository inside “repositories”, as follow:
// ... { "type" : "vcs", "url" : "https://github.com/yourgithubuser/library", "no-api": true } // ...
Now, our composer.json will look like this:
{ "require": { "awesome/library": "dev-my-fork-awesome-feature" }, "repositories" : [ { "type" : "vcs", "url" : "https://github.com/yourgithubuser/library", "no-api": true } ] }
That’s it!
leave a comment