Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variable returns None #123

Closed
sahiljhawar opened this issue Mar 8, 2024 · 9 comments · Fixed by #124
Closed

Environment variable returns None #123

sahiljhawar opened this issue Mar 8, 2024 · 9 comments · Fixed by #124

Comments

@sahiljhawar
Copy link

I added the environment variable to the repo however while deploying the pages, the following error occurs.

Exception occurred:
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/sphinx_github_changelog/changelog.py", line 44, in compute_changelog
    return no_token(changelog_url=options["changelog-url"])
KeyError: 'changelog-url'
@sahiljhawar
Copy link
Author

I am using the variable inside conf.py

sphinx_github_changelog_token = os.getenv("SPHINX_GITHUB_CHANGELOG_TOKEN")

When I set the same secret on my local machine, everything worked fine but on the production docs it is not working.

@sahiljhawar
Copy link
Author

on the documentation website the following appears:

Warning
Changelog was not built because sphinx_github_changelog_token parameter is missing in the documentation configuration.

@sahiljhawar
Copy link
Author

and when I add the change-log url it refers to same page:

https://nuclear-multimessenger-astronomy.github.io/nmma/changelog.html

@sahiljhawar
Copy link
Author

sahiljhawar commented Mar 8, 2024

@ewjoachim
Copy link
Owner

Yes, the environment variable needs to be set at the step where the doc is built, otherwise it's not found when building.

That said, the error should look nicer.

@ewjoachim
Copy link
Owner

sphinx_github_changelog_token = os.getenv("SPHINX_GITHUB_CHANGELOG_TOKEN")

This is not useful, the value of the token is by default the value of the SPHINX_GITHUB_CHANGELOG_TOKEN, per documentation. You can remove this line from conf.py, it should still work.

@ewjoachim ewjoachim mentioned this issue Mar 9, 2024
4 tasks
@ewjoachim
Copy link
Owner

That said, the error should look nicer.

Turns out it was a bug due to the lib not handling correctly the case where there's no token and no changelog-url. Fixed in #124.

@sahiljhawar
Copy link
Author

Thanks, I realised I was not using variable at the correct place in the yml. This is mainly due to my novice knowledge in CI/CD.

@ewjoachim
Copy link
Owner

Yeah, but your report led to fixing a real bug in the lib, so congratulations :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants