New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to master branch on GitHub Pages triggers another build #9329

Closed
sarahdayan opened this Issue Mar 13, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@sarahdayan

sarahdayan commented Mar 13, 2018

Hi! I'm encountering an issue when I use Travi-CI's deploy feature to build my docs automatically and push it to my master branch. I build my docs in a /docs directory, so there's no reason for me to use a separate gh-pages branch. Problem is, since Travis Deployment Bot commits to master, a new build is triggered.

Options for deploy are currently limited, and as seen in issue #9287, there's no way to customize the commit message (which would allow for adding [skip-ci] and solve the issue).

It would be awesome to either be able to specify a custom commit message, or have an additional option like skip-ci: true which would prevent subsequent builds.

In the meantime, is there another workaround that would avoid having to use a separate gh-pages branch?

Thanks in advance!

@BanzaiMan

This comment has been minimized.

Member

BanzaiMan commented Mar 14, 2018

The build should be disabled in the gh-pages branch, but it seems that this is not the case for you. Do you have a build log URL to show the problem you are having?

@sarahdayan

This comment has been minimized.

sarahdayan commented Mar 14, 2018

@BanzaiMan Sorry if I wasn't clear in my initial message, the build is disabled indeed in gh-pages. The thing is, I don't want to deploy to gh-pages, I want to deploy in master. This is why a second build is triggered: since Travis bot pushes to master, and master is set to build automatically, a new build starts.

What I would like to be able to do is to disable the trigger of a second build when this comes as a result from using the deploy feature in Travis. I'm thinking, either a [skip-ci] in the Travis bot commit message, an option under deploy in travis.yml, or maybe some kind of setting that disables builds when triggered by the Travis bot.

Is there any way this is currently possible?

@BanzaiMan

This comment has been minimized.

Member

BanzaiMan commented Mar 14, 2018

OK. I understand now.

Using the commit message to skip the build seems reasonable. As you point out, that functionality is absent in the provider. Perhaps you can add it. I'm closing this one and reopening #9287, as it seems a reasonable use case.

@BanzaiMan BanzaiMan closed this Mar 14, 2018

jdblischak added a commit to workflowr/workflowr-metrics that referenced this issue Nov 9, 2018

@jdblischak

This comment has been minimized.

jdblischak commented Nov 9, 2018

@sarahdayan As a workaround to directly commit changes to the master branch after Travis CI finishes, I adapted this SO answer. The following worked for me:

after_success: |
  if [ -n "$GITHUB_TOKEN" ]; then
    git config user.name "Travis CI"
    git config user.email "Travis CI"
    git checkout -q master
    git add <updated files you want to commit>
    git commit --allow-empty -m "Update repo [skip ci]"
    git remote add authenticated https://<username>:$GITHUB_TOKEN@github.com/<username>/<repo-name>.git
    git push --quiet authenticated master &>/dev/null
  fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment