Skip to content

Commit d03763e

Browse files
committed
Add environment variable checks for GITHUB_TOKEN and REPOSITORY_NAME
1 parent e0dde1a commit d03763e

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/utils/changelog.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,22 @@
3838
## --------------------------------------------------------------------------- #
3939

4040

41+
### Environment Variables ----
42+
TOKEN: str | None = os.environ.get("GITHUB_TOKEN")
43+
REPOSITORY_NAME: str | None = os.environ.get("REPOSITORY_NAME")
44+
if TOKEN is None:
45+
raise RuntimeError(
46+
"Environment variable `GITHUB_TOKEN` is not set. Please set it before running the script."
47+
)
48+
if REPOSITORY_NAME is None:
49+
raise RuntimeError(
50+
"Environment variable `REPOSITORY_NAME` is not set. Please set it before running the script."
51+
)
52+
53+
54+
### Static ----
4155
OUTPUT_FILENAME: str = "CHANGELOG.md"
4256
OUTPUT_FILEPATH: Path = Path(OUTPUT_FILENAME)
43-
TOKEN: str = os.environ["GITHUB_TOKEN"]
44-
REPOSITORY_NAME: str = os.environ["REPOSITORY_NAME"]
4557
AUTH: Token = Auth.Token(TOKEN)
4658
NEW_LINE: str = "\n"
4759
BLANK_LINE: str = "\n\n"

0 commit comments

Comments
 (0)