Skip to content

Commit 78efacc

Browse files
committed
Generalize reporting structure
1 parent 7dcb8aa commit 78efacc

File tree

10 files changed

+539
-65
lines changed

10 files changed

+539
-65
lines changed

docs/adopting.md

Lines changed: 445 additions & 0 deletions
Large diffs are not rendered by default.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ nav:
1414
- PI Objectives: "objectives.md"
1515
- ODD Products: "products.md"
1616
- Tech Tips: "tech-tips.md"
17+
- Adopting This Structure: "adopting.md"
1718

1819
theme:
1920
language: en

reports/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
1. Navigate to https://github.com/settings/personal-access-tokens/new
66
2. Select public repositories
7-
3. Add new token as the environment variable `GH_ODD_PAT`
7+
3. Add new token as the environment variable specified by `TOKEN_ENV_VAR` in `settings.py` (default: `GH_ODD_PAT`)
88

99
## Configuration
1010

@@ -29,7 +29,7 @@ This generates `objectives_config.py` with objectives and contributors from issu
2929

3030
`TIME_RANGE` is automatically set to the current fiscal quarter (Q1: Oct-Dec, Q2: Jan-Mar, Q3: Apr-Jun, Q4: Jul-Sep).
3131

32-
The generated chart colors bars by PI objective (see [objectives page](https://nasa-impact.github.io/veda-odd/objectives) for details).
32+
The generated chart colors bars by PI objective (see the objectives page on the deployed site for details).
3333

3434
### Regenerating docs/objectives.md
3535

reports/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def get_time_range(pi: str = None):
302302
],
303303
"repos": [
304304
("zarr-developers", "virtualizarr"),
305-
("virtual-zarr", "obspec-utils"),
305+
("developmentseed", "obspec-utils"),
306306
("virtual-zarr", "virtual-tiff"),
307307
("virtual-zarr", "hrrr-parser"),
308308
("developmentseed", "async-tiff"),
@@ -426,7 +426,7 @@ def get_time_range(pi: str = None):
426426
"repos": [
427427
("zarr-developers", "virtualizarr"),
428428
("zarr-developers", "zarr-python"),
429-
("virtual-zarr", "obspec-utils"),
429+
("developmentseed", "obspec-utils"),
430430
("virtual-zarr", "virtual-tiff"),
431431
("virtual-zarr", "hrrr-parser"),
432432
("developmentseed", "virtualizarr-data-pipelines"),
@@ -445,7 +445,7 @@ def get_time_range(pi: str = None):
445445
],
446446
"repos": [
447447
("zarr-developers", "virtualizarr"),
448-
("virtual-zarr", "obspec-utils"),
448+
("developmentseed", "obspec-utils"),
449449
("virtual-zarr", "virtual-tiff"),
450450
("developmentseed", "obstore"),
451451
("developmentseed", "obspec"),

reports/generate_config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import os
1515
import re
1616
from github import Github, Auth
17+
from settings import REPO_FULL_NAME, TOKEN_ENV_VAR
1718

1819

19-
def get_objective_issues(g: Github, repo_name: str = "NASA-IMPACT/veda-odd"):
20+
def get_objective_issues(g: Github, repo_name: str = REPO_FULL_NAME):
2021
"""Fetch all issues with pi-*-objective labels using search API."""
2122
objectives_by_pi = {}
2223

@@ -188,9 +189,9 @@ def generate_config(objectives_by_pi: dict) -> str:
188189

189190

190191
def main():
191-
token = os.environ.get("GH_ODD_PAT") or os.environ.get("GITHUB_TOKEN")
192+
token = os.environ.get(TOKEN_ENV_VAR) or os.environ.get("GITHUB_TOKEN")
192193
if not token:
193-
raise ValueError("Set GH_ODD_PAT or GITHUB_TOKEN environment variable")
194+
raise ValueError(f"Set {TOKEN_ENV_VAR} or GITHUB_TOKEN environment variable")
194195

195196
auth = Auth.Token(token)
196197
g = Github(auth=auth)

reports/generate_docs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
from config import OBJECTIVES
10+
from settings import REPO_URL
1011

1112

1213
def generate_objectives_md() -> str:
@@ -46,7 +47,7 @@ def generate_objectives_md() -> str:
4647
repos = ", ".join(r for _, r in obj["repos"]) if obj["repos"] else "-"
4748

4849
lines.append(
49-
f"| [#{num}](https://github.com/NASA-IMPACT/veda-odd/issues/{num}) | {title} | {contributors} | {repos} |"
50+
f"| [#{num}]({REPO_URL}/issues/{num}) | {title} | {contributors} | {repos} |"
5051
)
5152

5253
lines.append("")
@@ -75,7 +76,7 @@ def generate_objectives_md() -> str:
7576
contributors = ", ".join(u for _, u in obj["contributors"])
7677

7778
lines.append(
78-
f"| [#{num}](https://github.com/NASA-IMPACT/veda-odd/issues/{num}) | {title} | {state} | {contributors} |"
79+
f"| [#{num}]({REPO_URL}/issues/{num}) | {title} | {state} | {contributors} |"
7980
)
8081

8182
lines.append("")
@@ -101,7 +102,7 @@ def generate_objectives_md() -> str:
101102
lines.append("## Configuration")
102103
lines.append("")
103104
lines.append(
104-
"Objectives are configured in [`reports/config.py`](https://github.com/NASA-IMPACT/veda-odd/blob/main/reports/config.py)."
105+
f"Objectives are configured in [`reports/config.py`]({REPO_URL}/blob/main/reports/config.py)."
105106
)
106107
lines.append("")
107108
lines.append("To regenerate this page from config:")

reports/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
get_repos_for_pi,
1616
get_contributors_for_pi,
1717
)
18+
from settings import TOKEN_ENV_VAR
1819

1920

2021
def get_commits_for_repo_author(
@@ -153,5 +154,5 @@ def process_task(task):
153154

154155

155156
if __name__ == "__main__":
156-
token = os.environ.get("GH_ODD_PAT") or os.environ.get("GITHUB_TOKEN")
157+
token = os.environ.get(TOKEN_ENV_VAR) or os.environ.get("GITHUB_TOKEN")
157158
main(token=token)

0 commit comments

Comments
 (0)