diff --git a/README.md b/README.md index 242ba6a..dc0189a 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,23 @@ It also depends on the Graphviz library; for Debian-based distros, install the After installing `poetry`, run `poetry install`. -The scripts provided by this project require two environment variables: +### Authorization Tokens + +The scripts provided by this project require two files: - `GITHUB_TOKEN`: a GitHub API token with permission to read the necessary repositories. -- `ZENHUB_TOKEN`: a ZenHub API token. +- `ZENHUB_TOKEN`: a ZenHub REST API token. (Not a GraphQL token.) + +After generating each token, paste the literal contents into the associated file. There is a +`.gitignore` which ignores these files to ensure they are not committed. Be careful to avoid +that editor temporary files or any copies or renames of these files aren't committed. You can generate a GitHub token with [this url](https://github.com/settings/tokens/new). This token should not have any excess authority; it only needs public read access! Make sure all of those extra capability checkboxes are unchecked. The DAG script depends upon GraphQL APIs for GitHub which can be generated using -`GITHUB_TOKEN= ./gen-schema.sh`. +`./gen-schema.sh`. ## Generating DAGs @@ -34,7 +40,13 @@ also supplied as environment variables: - `SHOW_EPICS=[true|false]`: Whether or not to render ZenHub epics as boxes (default: `false`). - `INCLUDE_FINISHED=[true|false]`: Whether or not to include closed issues with no open blockers (default: `false`). -Here's an example script for easily running the DAG generator: +Example command: + +``` +DAG_VIEW=core SHOW_MILESTONES=false poetry run python ./zcash-issue-dag.py +``` + +Here's an example command for easily running the DAG generator: ```bash #!/usr/bin/env bash diff --git a/gen-dag.sh b/gen-dag.sh new file mode 100755 index 0000000..ef20663 --- /dev/null +++ b/gen-dag.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -efuo pipefail + +views=${*:-core wallet tfl halo2 zf} + +for view in ${views} +do + echo Generating ${view} DAG... + DAG_VIEW=${view} \ + SHOW_MILESTONES=true \ + SHOW_EPICS=true \ + GITHUB_TOKEN="$(cat GITHUB_TOKEN)" \ + ZENHUB_TOKEN="$(cat ZENHUB_TOKEN)" \ + poetry run python ./zcash-issue-dag.py +done diff --git a/gen-schema.sh b/gen-schema.sh index ab01dc1..ae2983e 100755 --- a/gen-schema.sh +++ b/gen-schema.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash +set -eu poetry run python3 -m sgqlc.introspection \ --exclude-deprecated \ --exclude-description \ - -H "Authorization: bearer $GITHUB_TOKEN" \ + -H "Authorization: bearer $(cat GITHUB_TOKEN)" \ https://api.github.com/graphql \ github_schema.json