Last active
May 14, 2020 12:42
-
-
Save tonyvince/d0e67c3020284bbb1c61c2cbb7519d99 to your computer and use it in GitHub Desktop.
Ruby script to automatically restart a travis-ci build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The script below checks a given build is running or not | |
# and restarts the build of not running | |
# | |
# This script is used to run a particular build for the duration of a day | |
# to catch all randombly failing tests | |
# | |
# To get access token, see here https://github.com/travis-ci/travis.rb#token | |
# ================================ | |
# for private repositories users | |
require 'travis/pro' | |
Travis::Pro.access_token = 'your access token' | |
repo = Travis::Pro::Repository.find('organization/repository') | |
build = repo.build(n) # where n is the travis-ci build number | |
build.restart unless build.running? | |
# ================================ | |
# ================================ | |
# for public repositories | |
require 'travis' | |
Travis.access_token = 'your access token' | |
repo = Travis::Repository.find('username/repository') | |
build = repo.build(n) # where n is the travis-ci build number | |
build.restart unless build.running? | |
# ================================ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment