Pivot to requiring credentials to be in well-named files rather than env variables.

This commit is contained in:
nate 2023-10-19 09:23:44 -07:00
parent 16e6b60248
commit 8ae500b7f0
3 changed files with 33 additions and 5 deletions

View File

@ -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=<INSERT> ./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

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