This commit is contained in:
Brandon Keepers
2017-09-09 16:56:13 +00:00
committed by GitHub
4 changed files with 38 additions and 12 deletions

View File

@@ -1,17 +1,15 @@
before_script: "./script/bootstrap"
script: "./script/test"
#environment
script: "./script/cibuild"
language: ruby
rvm:
- 2.4.0
- 2.4.0
notifications:
email: false
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
- GIT_AUTHOR_NAME="Probot"
- GIT_AUTHOR_EMAIL="bkeepers+probot@github.com"
- secure: gGUZ+Mtu0LgGhxh9Gd/0gOvoCvoFipi/c6N/4lw5vQtCj7bweQw9/4D6ywpdAc2EDqp9oQ67qBuqLWk5kIhtD3eR7F8thzfF/EeqwizHN6ILqFivDb5a2vFa4b00IOAQFICH9whPT9l673lQ9aysnLlQXi2SwQdV4ysW9UkJaUtKPVSUGer46kN/YvtqyaV//kYksugqUz6pZzPxEtdAgvDIQ8R8p7G0cE/CRcAfHB1D/jS3AfIKzdgdbRxRlTPr0fIi8DQhDGr3o/sPLXotblG9btonVov2jcJpM6+2mZBaiR5V2h9WzjLa3ubk3qq26qKzURVjdFCx5USd/BB+clyadgMxgARKhODq65UYGPaiSZ8poheFz7PtfyvIx6L6miqG8B6uPiIy9553xnVT7Z+ZrqrE7hqUmyzPTfXQ6bAje3Aez2NTjRw0fri5O/pjyhrbkb/0trXguKrvFqeBRYxklM4ES6XHfNmo88APfB7FBs/k5TCgdKSC9FuJwY5IFLt0zWIvtAGTHn//1Zvjak+fXbo5nKzYinfb6c7Ba7v22o+VKawxJd6YUOMpLbCfD59puRtRlP/fnydNJqc553Oqvz/dMLfvMMCB95ZnfZ9rdhPMpNN0GWU7k3NeSorAOVKnAmLDRHAyfO3YOignvOKo0Ymnhq9OcGb+Of7jq4M=
sudo: false
cache: bundler

6
script/cibuild Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
case "$TRAVIS_EVENT_TYPE" in
cron|pull_request ) script/remote-sync;;
* ) script/test;;
esac

22
script/remote-sync Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Run script/sync-data and push changes.
set -x # print commands before execution
set -o errexit # always exit on error
set -o pipefail # honor exit codes when piping
echo "===> Syncing data"
script/sync-data
git diff --quiet || {
echo "===> Committing and pushing changes"
git commit -am "Sync data"
REPO=`git config remote.origin.url`
if [[ -n "$GH_TOKEN" ]]; then
REPO=${REPO/https:\/\//https://${GH_TOKEN}@}
fi
git push $REPO HEAD:$TRAVIS_BRANCH
}

View File

@@ -1,13 +1,13 @@
#!/usr/bin/env ruby
# Sync data for apps from GitHub
require 'open-uri'
require "bundler/setup"
require "open-uri"
require "octokit"
client = Octokit::Client.new(:access_token => ENV["GITHUB_TOKEN"])
client = Octokit::Client.new(:access_token => ENV["GH_TOKEN"])
require "jekyll"
config = Jekyll.configuration("source" => File.expand_path('../', File.dirname(__FILE__)))
config = Jekyll.configuration("source" => File.expand_path("../", File.dirname(__FILE__)))
site = Jekyll::Site.new(config)
site.read