Setting up Echidna as a GitHub hook
Clone this wiki locally
You can use Travis integration to ping Echidna whenever there's a commit.
This PR might be useful for you as template of sorts: it contains almost every change that was needed in real repos to set them up for automatic publication with Echidna.
For this you will need:
- Everything set up as per Using Echidna with ReSpec.
- The following
.travis.ymlin your repo, in the branch you wish to publish from (suitably modified)
Travis CI integration activated for that repo;
FYI you can activate the Travis CI service from your GitHub repo UI under
Settings > Webhooks & services; this requires the intervention from someone who has admin access (but it's just a button to push).
language: node_js branches: only: - gh-pages env: global: - URL="http://w3c.github.io/manifest/ECHIDNA" - DECISION="https://lists.w3.org/Archives/Public/public-webapps/2014JulSep/0627.html" - secure: "<your encrypted token here!>" script: - echo "ok" after_success: - test $TRAVIS_PULL_REQUEST = false && curl "https://labs.w3.org/echidna/api/request" --data "url=$URL" --data "decision=$DECISION" --data "token=$TOKEN"
A few notes on the
- It says
language: node_js. Ignore that. If you don't specify a language, Travis gives a warning. This is just to silence it.
onlyyou want to include the branch you are publishing from. I STRONGLY recommend that you publish only from one branch; hence the lines. Also, Travis ignores
gh-pagesunless you include this.
globalyou will want to change all three of
URL(the URL of your file or manifest),
DECISION(the decision to publish), and the weird-looking
secure line is actually the encrypted token that you were given to publish with Echidna. It's probably a better idea to encrypt it, as done in the example above. Thankfully, it's very simple.
Basically, you install the travis tool (
gem install travis --no-rdoc --no-ri), then run:
travis encrypt TOKEN=your.beautiful.token
This will respond with:
secure: "some encrypted garbage"
You can just paste the garbage on that line and it'll work. More details about encrypting stuff on the Travis site, should you need it.
You should also check the syntax of your
.travis.yml before committing it.
travis lint .travis.yml
That's all! With that in place, every commit you make to that branch gets you published in TR. You can see the build status at https://travis-ci.org/USER/REPO (e.g. https://travis-ci.org/w3c/manifest).
Note that this can sometimes be slow, but it'll work eventually.
Also note that you won't be told through Travis if Echidna fails. That can only happen later.