Expose the DAG script parameters as environment variables

This commit is contained in:
Jack Grigg 2021-06-15 16:46:47 +01:00
parent 0abd60188c
commit eb4de7a82a
1 changed files with 13 additions and 4 deletions

View File

@ -7,6 +7,7 @@
import drest import drest
import networkx as nx import networkx as nx
from distutils.util import strtobool
import mimetypes import mimetypes
import os import os
from textwrap import wrap from textwrap import wrap
@ -19,7 +20,9 @@ from github_schema import github_schema as schema
GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN') GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN')
ZENHUB_TOKEN = os.environ.get('ZENHUB_TOKEN') ZENHUB_TOKEN = os.environ.get('ZENHUB_TOKEN')
REPOS = { DAG_VIEW = os.environ.get('DAG_VIEW', 'core')
CORE_REPOS = {
26987049: ('zcash', 'zcash'), 26987049: ('zcash', 'zcash'),
47279130: ('zcash', 'zips'), 47279130: ('zcash', 'zips'),
85334928: ('zcash', 'librustzcash'), 85334928: ('zcash', 'librustzcash'),
@ -28,11 +31,17 @@ REPOS = {
305835578: ('zcash', 'orchard'), 305835578: ('zcash', 'orchard'),
} }
REPO_SETS = {
'core': CORE_REPOS,
}
REPOS = REPO_SETS[DAG_VIEW]
# Whether to include subgraphs where all issues and PRs are closed. # Whether to include subgraphs where all issues and PRs are closed.
INCLUDE_FINISHED = False INCLUDE_FINISHED = strtobool(os.environ.get('INCLUDE_FINISHED', 'false'))
# Whether to group issues and PRs by milestone. # Whether to group issues and PRs by milestone.
SHOW_MILESTONES = False SHOW_MILESTONES = strtobool(os.environ.get('SHOW_MILESTONES', 'false'))
class GitHubIssue: class GitHubIssue:
@ -232,7 +241,7 @@ def main():
ag.graph_attr['rankdir'] = 'LR' ag.graph_attr['rankdir'] = 'LR'
ag.layout(prog='dot') ag.layout(prog='dot')
os.makedirs('public', exist_ok=True) os.makedirs('public', exist_ok=True)
ag.draw('public/zcash-core-dag.svg') ag.draw('public/zcash-%s-dag.svg' % DAG_VIEW)
if __name__ == '__main__': if __name__ == '__main__':