Closed razor-x closed 9 years ago
Actually, to handle the case of forking a user repo, we need
t.deploy_branch = -> {
user = ENV['TRAVIS_REPO_SLUG'].to_s.split('/').first
t.remote_url.match(%r{(:|/)#{user}\.github\.io\.git$}) ? 'master' : 'gh-pages'
}
Why /github\.io\.git$/
isn’t sufficient?
The obvious scenario I came up with is if you fork someone's io repo, then it will still match that pattern but since the username in the repo name is not yours, it will serve from the gh-pages branch.
For example, if I fork them/them.github.io
to me/them.github.io
, then me/them.github.io
needs to deploy to the gh-pages branch.
Ah, you’re right. By the way, when the generated content is in the master branch, what’s the source branch?
I don't think GitHub has the concept of a "source branch". They just designate a special branch to be the one to serve content from (they run Jekyll on that unless you add .nojekyll
). How stuff ends up in that branch is up to us. That's one of the reasons I originally submitted #7.
:+1:
Any chance you can add this for v1.1.0?
For
username.github.io
repos, the master branch is used for serving to GitHub Pages. To auto-detect this I'm using: