Skip to content

Instantly share code, notes, and snippets.

@astrofrog
Last active October 31, 2016 20:06
Show Gist options
  • Select an option

  • Save astrofrog/061aed7312da223f76ba38e096981780 to your computer and use it in GitHub Desktop.

Select an option

Save astrofrog/061aed7312da223f76ba38e096981780 to your computer and use it in GitHub Desktop.
# pip install travispy pync
import os
import sys
from travispy import TravisPy
from pync import Notifier
if 'GITHUB_API_TOKEN' in os.environ:
GITHUB_API_TOKEN = os.environ["GITHUB_API_TOKEN"]
else:
print("The GITHUB_API_TOKEN environment variable needs to be set")
sys.exit(0)
t = TravisPy.github_auth(GITHUB_API_TOKEN)
latest_build = t.builds(slug='astropy/astropy', event_type='push')[0]
for job_id in latest_build.job_ids:
job = t.jobs(ids=job_id)[0]
if 'NUMPY_VERSION=dev' in job.config['env']:
break
else:
print("No build found with NUMPY_VERSION=dev")
sys.exit(0)
if job.state == latest_build.FAILED:
Notifier.notify('The NUMPY_VERSION=dev build on Astropy is failing :-(')
elif job.state == latest_build.PASSED:
Notifier.notify('The NUMPY_VERSION=dev build on Astropy is passing :-)')
elif job.state == latest_build.ERRORED:
Notifier.notify('The NUMPY_VERSION=dev build on Astropy has errored :-/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment