Skip to content

Commit

Permalink
Merge pull request #49 from vrenjith/master
Browse files Browse the repository at this point in the history
Support for API Version in URL for GitHub Enterprise
  • Loading branch information
ojacques authored Feb 24, 2024
2 parents 932c4d8 + b3d1a6c commit 0f31eb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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

0 comments on commit 0f31eb6

Please sign in to comment.