Merge pull request #37 from nathan-at-least/ignore-local-credentials

Use credentials in well-known filenames.
This commit is contained in:
Nathan Wilcox 2023-11-29 08:03:00 -08:00 committed by GitHub
commit d6691cb2b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 50 deletions

5
.gitignore vendored
View File

@ -4,3 +4,8 @@ public/*.svg
github_schema.json
github_schema.py
poetry.lock
GITHUB_TOKEN
ZENHUB_TOKEN

View File

@ -12,38 +12,39 @@ 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=<INSERT> ./gen-schema.sh`.
`./gen-schema.sh`.
## Generating DAGs
The `zcash-issue-dag.py` script supports several configuration options,
also supplied as environment variables:
The simplest way to generate one or more DAGs is to use `./gen-dag.sh` script. This takes
a list of DAGs to render as arguments (default: `core wallet tfl halo2 zf`).
Alternatively, the `zcash-issue-dag.py` script supports several configuration options
supplied as environment variables:
- `DAG_VIEW=[core|halo2|tfl|wallet|wallet-ios|wallet-android|zf]`: The DAG to render (default: `core`).
- `SHOW_MILESTONES=[true|false]`: Whether or not to render GitHub milestones as boxes (default: `false`).
- `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:
```bash
#!/usr/bin/env bash
DAG_VIEW=core \
SHOW_MILESTONES=false \
GITHUB_TOKEN=<INSERT> \
ZENHUB_TOKEN=<INSERT> \
poetry run python ./zcash-issue-dag.py
```
You can find a series of template script files inside the folder `template_scripts`.
DAG_VIEW=core SHOW_MILESTONES=false poetry run python ./zcash-issue-dag.py
```

15
gen-dag.sh Executable file
View File

@ -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

View File

@ -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

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
#GITHUB_TOKEN=<INSERT> \
#ZENHUB_TOKEN=<INSERT> \
poetry run python3 -m sgqlc.introspection \
--exclude-deprecated \
--exclude-description \
-H "Authorization: bearer $GITHUB_TOKEN" \
https://api.github.com/graphql \
github_schema.json
poetry run sgqlc-codegen schema github_schema.json github_schema.py

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
DAG_VIEW=wallet-android \
SHOW_MILESTONES=true \
#GITHUB_TOKEN=<INSERT> \
#ZENHUB_TOKEN=<INSERT> \
poetry run python ./zcash-issue-dag.py

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
DAG_VIEW=wallet \
SHOW_MILESTONES=true \
#GITHUB_TOKEN=<INSERT> \
#ZENHUB_TOKEN=<INSERT> \
poetry run python ./zcash-issue-dag.py

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
DAG_VIEW=wallet-ios \
SHOW_MILESTONES=true \
#GITHUB_TOKEN=<INSERT> \
#ZENHUB_TOKEN=<INSERT> \
poetry run python ./zcash-issue-dag.py