grunt-gh-pages icon indicating copy to clipboard operation
grunt-gh-pages copied to clipboard

feature: restrict execution to branch

Open boneskull opened this issue 9 years ago • 4 comments

You have two branches, master and foo. Both have the gh-pages task defined, but foo's is incorrect for whatever reason.

You run gh-pages while in foo. Whoops! The wrong files got deployed. Maybe you didn't notice.

I think most people will want to run gh-pages against master.

What about an option that, by default, says you cannot run the gh-pages task from any other branch than master? Then allow the user to provide an array of "allowed" branches if their use case differs.

boneskull avatar Aug 07 '14 05:08 boneskull

Yes! This just bitten me. Deploy should only ever happen on master.

badboy avatar Mar 25 '15 16:03 badboy

Now that I think about it (and after fixing my build) my first comment was a bit too fast. The following travis config will prevent any deploys on non-master branches:

after_success:
  - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && grunt gh-pages

It might make sense to add a note to the Readme telling about this. :)

badboy avatar Mar 25 '15 17:03 badboy

@badboy I didn't think of delegating the task to Travis. However, say I'm just running grunt gh-pages from the command-line.

boneskull avatar Mar 25 '15 20:03 boneskull

@boneskull: Yip, just wanted to mention that in my case it's possible to circumvent this through other means.

badboy avatar Mar 25 '15 20:03 badboy