mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
fix(ci): remove unused scripts
This commit is contained in:
committed by
Łukasz Mierzwa
parent
4a718cb076
commit
91a00c00c5
@@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
|
||||
def downloadFile(workdir, path, uri, token):
|
||||
req = urllib2.Request(uri)
|
||||
req.add_header('Authorization', 'token %s' % token)
|
||||
try:
|
||||
response = urllib2.urlopen(req)
|
||||
except Exception as e:
|
||||
print("Request to '%s' failed: %s" % (uri, e))
|
||||
else:
|
||||
with open(os.path.join(workdir, path), "wb") as local_file:
|
||||
local_file.write(response.read())
|
||||
|
||||
|
||||
def getGist(workdir, gist_id, token):
|
||||
api = 'api.github.com'
|
||||
uri = 'https://{api}/gists/{gist_id}'.format(api=api, gist_id=gist_id)
|
||||
|
||||
req = urllib2.Request(uri)
|
||||
req.add_header('Authorization', 'token %s' % token)
|
||||
try:
|
||||
response = urllib2.urlopen(req)
|
||||
except Exception as e:
|
||||
print("Request to '%s' failed: %s" % (uri, e))
|
||||
else:
|
||||
data = json.load(response)
|
||||
for filename, meta in data['files'].items():
|
||||
print('Fetching {filename} from {uri}'.format(
|
||||
filename=filename, uri=meta['raw_url']))
|
||||
downloadFile(workdir, filename, meta['raw_url'], token)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print('Usage: GIST_ID WORKDIR')
|
||||
sys.exit(1)
|
||||
|
||||
token = os.getenv('GITHUB_TOKEN')
|
||||
if not token:
|
||||
print('GITHUB_TOKEN env variable is missing')
|
||||
sys.exit(1)
|
||||
|
||||
gist_id = sys.argv[1]
|
||||
workdir = sys.argv[2]
|
||||
if not gist_id or not workdir:
|
||||
print('Usage: GIST_ID WORKDIR')
|
||||
sys.exit(1)
|
||||
|
||||
getGist(workdir, gist_id, token)
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
|
||||
def patchGist(filepath, gist_id, token):
|
||||
api = 'api.github.com'
|
||||
uri = 'https://{api}/gists/{gist_id}'.format(api=api, gist_id=gist_id)
|
||||
|
||||
with open(filepath) as f:
|
||||
data = f.read()
|
||||
|
||||
filename = os.path.basename(filepath)
|
||||
payload = {
|
||||
"description": "Webpack bundle size stats",
|
||||
"files": {
|
||||
filename: {
|
||||
"content": data,
|
||||
"filename": filename
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
req = urllib2.Request(uri)
|
||||
req.get_method = lambda: 'PATCH'
|
||||
req.add_header('Authorization', 'token %s' % token)
|
||||
try:
|
||||
response = urllib2.urlopen(req, json.dumps(payload))
|
||||
except Exception as e:
|
||||
print("Request to '%s' failed: %s" % (uri, e))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print('Usage: GIST_ID FILE')
|
||||
sys.exit(1)
|
||||
|
||||
token = os.getenv('GITHUB_TOKEN')
|
||||
if not token:
|
||||
print('GITHUB_TOKEN env variable is missing')
|
||||
sys.exit(1)
|
||||
|
||||
gist_id = sys.argv[1]
|
||||
filepath = sys.argv[2]
|
||||
if not gist_id or not filepath:
|
||||
print('Usage: GIST_ID FILE')
|
||||
sys.exit(1)
|
||||
|
||||
patchGist(filepath, gist_id, token)
|
||||
Reference in New Issue
Block a user