Last active
February 15, 2017 21:20
-
-
Save gmarceau/43ac17046c828939c0d6033bb3b82b57 to your computer and use it in GitHub Desktop.
Send the output of a command to an Airtable table, along with timestamp and summary of the current git state
This file contains 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
#!/usr/bin/env python | |
import sys | |
from airtable import airtable | |
import datetime | |
from plumbum.cmd import git | |
_, api_key, base_id, table_name = sys.argv[0:4] | |
all_stdin = sys.stdin.read() | |
branch = git('rev-parse', '--abbrev-ref', 'HEAD').strip() | |
commit = git('rev-parse', '--short', 'HEAD').strip() | |
diffs = git('diff', '--shortstat') | |
git_status = '{} {} {}'.format(branch, commit, diffs) | |
at = airtable.Airtable(base_id, api_key) | |
fields = { | |
'Date Time': str(datetime.datetime.now()), | |
'Commit': git_status, | |
'Output': all_stdin | |
} | |
at.create(table_name, fields) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment