-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
24 lines (21 loc) · 895 Bytes
/
Copy pathrun.py
File metadata and controls
24 lines (21 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests
import urllib.request
import zipfile
import os
#if os.path.exists('./bobby.zip'):
# os.remove('./bobby.zip')
#if os.path.exists('./bobby.jar'):
# os.remove('./bobby.jar')
#requires 'token' file to contain github personal token with public repo access
github_token = open('./token','r').read().rstrip('\n')
artifacts_url = 'https://api.github.com/repos/ahlinist/bobby-cpp/actions/artifacts'
artifacts = requests.get(url=artifacts_url)
artifacts_json = artifacts.json()
artifacts_array = artifacts_json['artifacts']
latest_artifact = artifacts_array[0]
zip_url = artifacts_url + '/' + str(latest_artifact['id']) + '/zip'
zip_url_response = requests.get(url=zip_url, headers={'Authorization': 'token ' + github_token})
open('./bobby.zip', 'wb').write(zip_url_response.content)
with zipfile.ZipFile('./bobby.zip', 'r') as zip_ref:
zip_ref.extractall('.')
os.system('./app')