-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Download analysis releases for use in paper compilation
- Loading branch information
1 parent
fcbcd34
commit 024d57f
Showing
5 changed files
with
52 additions
and
19 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
build/* | ||
data/* | ||
downloads/* | ||
env/* | ||
pandoc-filters/* |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PyGithub |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import argparse | ||
from github import Github | ||
import requests | ||
from pathlib import Path | ||
import os | ||
|
||
organization='OA-WCVP' | ||
|
||
def main(): | ||
# Read repo, version tag, and artifact name from command line | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("repo", type=str) | ||
args = parser.parse_args() | ||
|
||
# Create a Github instance, using an access token: | ||
access_token = os.getenv('GITHUB_TOKEN') | ||
g = Github(access_token) | ||
repo = g.get_repo('{org}/{repo}'.format(org=organization,repo=args.repo)) | ||
release = repo.get_latest_release() | ||
for asset in release.get_assets(): | ||
# Initiate a session | ||
headers = {'Authorization': 'token ' + access_token, | ||
'Accept': 'application/octet-stream'} | ||
session = requests.Session() | ||
response = session.get(asset.url, stream = True, headers=headers) | ||
dest = Path() / "downloads" / asset.name | ||
with open(dest, 'wb') as f: | ||
for chunk in response.iter_content(1024*1024): | ||
f.write(chunk) | ||
|
||
if __name__ == '__main__': | ||
main() | ||
|
||
|