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

Support for API Version in URL for GitHub Enterprise #49

Merged
merged 4 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ unless you access private repositories.
unless you access private repositories. For GitLab, create a token at
[gitlab.com/-/profile/personal_access_tokens](https://gitlab.com/-/profile/personal_access_tokens).
- `enterprise_hostname` - For GitHub enterprise: the GitHub enterprise hostname.
- `gitlab_hostname` - For GitLab: the GitLab hostname if different from
- `gitlab_hostname` - For GitLab: the GitLab hostname if different from
gitlab.com (self-hosted).
- `api_version` - For GitHub and GitLab self-hosted, the API version part that needs to be appended to the URL.
Defaults to v4 for GitLab, and nothing for GitHub Enterprise (you may need `v3`).
- `docs_path` - the path to the documentation folder. Defaults to `docs`.
- `cache_dir` - The path which holds the authors cache file to speed up
documentation builds. Defaults to `.cache/plugin/git-committers/`. The cache
Expand Down
10 changes: 8 additions & 2 deletions mkdocs_git_committers_plugin_2/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ def on_config(self, config):
LOG.error("git-committers plugin: repository not specified")
return config
if self.config['enterprise_hostname'] and self.config['enterprise_hostname'] != '':
self.githuburl = "https://" + self.config['enterprise_hostname'] + "/api"
if not self.config['api_version']:
self.githuburl = "https://" + self.config['enterprise_hostname'] + "/api"
else:
self.githuburl = "https://" + self.config['enterprise_hostname'] + "/api/" + self.config['api_version']
if self.config['gitlab_hostname'] and self.config['gitlab_hostname'] != '':
self.gitlaburl = "https://" + self.config['gitlab_hostname'] + "/api/v4"
if not self.config['api_version']:
self.gitlaburl = "https://" + self.config['gitlab_hostname'] + "/api/v4"
else:
self.gitlaburl = "https://" + self.config['gitlab_hostname'] + "/api/" + self.config['api_version']
# gitlab_repository must be set
if not self.config['gitlab_repository']:
LOG.error("git-committers plugin: gitlab_repository must be set, with the GitLab project ID")
Expand Down