Skip to content

Commit 04379a2

Browse files
committed
Update changelog generation process to use environment variables during the CD pipeline
1 parent ae4493b commit 04379a2

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/cd.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,12 @@ jobs:
352352
uv run git-switch-to-main-branch
353353
uv run git-refresh-current-branch
354354
355-
- name: Build ChangeLog
356-
id: build-changelog
357-
run: uv run build-changelog
355+
- name: Generate ChangeLog
356+
id: generate-changelog
357+
env:
358+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
359+
REPOSITORY_NAME: data-science-extensions/toolbox-python
360+
run: uv run generate-changelog
358361

359362
- name: Commit ChangeLog
360363
id: commit-changelog

src/utils/changelog.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
OUTPUT_FILENAME: str = "CHANGELOG.md"
4242
OUTPUT_FILEPATH: Path = Path(OUTPUT_FILENAME)
4343
TOKEN: str = os.environ["GITHUB_TOKEN"]
44+
REPOSITORY_NAME: str = os.environ["REPOSITORY_NAME"]
4445
AUTH: Token = Auth.Token(TOKEN)
4546
NEW_LINE: str = "\n"
4647
BLANK_LINE: str = "\n\n"
@@ -171,10 +172,8 @@ def main() -> None:
171172
### Open the contexts ----
172173
with Github(auth=AUTH) as g, open(OUTPUT_FILENAME, "w") as f:
173174

174-
# NOTE: The repository is hardcoded here, but you can modify it to fetch from an environment variable or a configuration file if needed. This is done to ensure that the script is self-contained and does not require external configuration.
175-
176175
### Get the repository ----
177-
REPO: Repository = g.get_repo("data-science-extensions/toolbox-python")
176+
REPO: Repository = g.get_repo(REPOSITORY_NAME)
178177

179178
### Write the header to the output file ----
180179
f.write(add_header(REPO))

0 commit comments

Comments
 (0)