aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml8
-rw-r--r--cgitize/config.py24
-rw-r--r--cgitize/github.py4
-rw-r--r--cgitize/gitlab.py4
-rw-r--r--examples/cgitize.toml13
5 files changed, 27 insertions, 26 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a161d91..05a8f6d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,14 +36,14 @@ jobs:
name: 'Test / example config'
env:
# API request rate limit is easily exceeded otherwise:
- CGITIZE_GITHUB_ACCESS_TOKEN: '${{ secrets.CGITIZE_GITHUB_ACCESS_TOKEN }}'
+ CGITIZE_GITHUB_TOKEN: '${{ secrets.CGITIZE_GITHUB_TOKEN }}'
# Consider creating a separate user (without my private repositories)
# for testing Bitbucket).
#CGITIZE_BITBUCKET_USERNAME: egor-tensin
- #CGITIZE_BITBUCKET_APP_PASSWORD: '${{ secrets.CGITIZE_BITBUCKET_APP_PASSWORD }}'
+ #CGITIZE_BITBUCKET_TOKEN: '${{ secrets.CGITIZE_BITBUCKET_TOKEN }}'
# Same goes for GitLab.
#CGITIZE_GITLAB_USERNAME: egor-tensin
- #CGITIZE_GITLAB_ACCESS_TOKEN: '${{ secrets.CGITIZE_GITLAB_ACCESS_TOKEN }}'
+ #CGITIZE_GITLAB_TOKEN: '${{ secrets.CGITIZE_GITLAB_TOKEN}}'
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -129,7 +129,7 @@ jobs:
name: 'Publish / PyPI'
env:
# Same rate limit thing:
- CGITIZE_GITHUB_ACCESS_TOKEN: '${{ secrets.CGITIZE_GITHUB_ACCESS_TOKEN }}'
+ CGITIZE_GITHUB_TOKEN: '${{ secrets.CGITIZE_GITHUB_TOKEN }}'
steps:
- name: Checkout
uses: actions/checkout@v2
diff --git a/cgitize/config.py b/cgitize/config.py
index 5b5fb32..af7c195 100644
--- a/cgitize/config.py
+++ b/cgitize/config.py
@@ -85,12 +85,12 @@ class GitHubSection(ServiceSection):
self.orgs = OrgsSection(self.impl.get('organizations', {}))
@property
- def access_token(self):
- return self._get_config_or_env('access_token', 'CGITIZE_GITHUB_ACCESS_TOKEN')
+ def token(self):
+ return self._get_config_or_env('token', 'CGITIZE_GITHUB_TOKEN')
@property
def url_auth(self):
- return self.access_token
+ return self.token
def enum_repositories(self, cfg):
yield from super().enum_repositories(cfg)
@@ -103,7 +103,7 @@ class GitHubSection(ServiceSection):
yield repo
def connect_to_service(self):
- return GitHub(self.access_token)
+ return GitHub(self.token)
def two_part_url_auth(username, password):
@@ -114,8 +114,8 @@ def two_part_url_auth(username, password):
class BitbucketSection(ServiceSection):
@property
- def app_password(self):
- return self._get_config_or_env('app_password', 'CGITIZE_BITBUCKET_APP_PASSWORD')
+ def token(self):
+ return self._get_config_or_env('token', 'CGITIZE_BITBUCKET_TOKEN')
@property
def username(self):
@@ -123,16 +123,16 @@ class BitbucketSection(ServiceSection):
@property
def url_auth(self):
- return two_part_url_auth(self.username, self.app_password)
+ return two_part_url_auth(self.username, self.token)
def connect_to_service(self):
- return Bitbucket(self.username, self.app_password)
+ return Bitbucket(self.username, self.token)
class GitLabSection(ServiceSection):
@property
- def access_token(self):
- return self._get_config_or_env('access_token', 'CGITIZE_GITLAB_ACCESS_TOKEN')
+ def token(self):
+ return self._get_config_or_env('token', 'CGITIZE_GITLAB_TOKEN')
@property
def username(self):
@@ -140,10 +140,10 @@ class GitLabSection(ServiceSection):
@property
def url_auth(self):
- return two_part_url_auth(self.username, self.access_token)
+ return two_part_url_auth(self.username, self.token)
def connect_to_service(self):
- return GitLab(self.access_token)
+ return GitLab(self.token)
class UsersSection(Section):
diff --git a/cgitize/github.py b/cgitize/github.py
index 5bbf8d8..b3dcc19 100644
--- a/cgitize/github.py
+++ b/cgitize/github.py
@@ -11,8 +11,8 @@ from cgitize.repo import Repo
class GitHub:
- def __init__(self, access_token):
- self._impl = Github(access_token)
+ def __init__(self, token):
+ self._impl = Github(token)
def get_repo(self, repo):
try:
diff --git a/cgitize/gitlab.py b/cgitize/gitlab.py
index 3589472..5728dfe 100644
--- a/cgitize/gitlab.py
+++ b/cgitize/gitlab.py
@@ -12,8 +12,8 @@ from cgitize.repo import Repo
class GitLab:
- def __init__(self, access_token):
- self._impl = Gitlab('https://gitlab.com', private_token=access_token)
+ def __init__(self, token):
+ self._impl = Gitlab('https://gitlab.com', private_token=token)
def get_repo(self, repo):
try:
diff --git a/examples/cgitize.toml b/examples/cgitize.toml
index fb76589..06d98cc 100644
--- a/examples/cgitize.toml
+++ b/examples/cgitize.toml
@@ -20,8 +20,8 @@ owner = "Your Name"
[github]
# If some of the repositories hosted on GitHub are private (or if you hit the
# request rate limit), use "access tokens". Also can be provided using the
-# CGITIZE_GITHUB_ACCESS_TOKEN environment variable.
-#access_token = "XXX"
+# CGITIZE_GITHUB_TOKEN environment variable.
+#token = "XXX"
[github.users.me]
name = "egor-tensin"
@@ -52,8 +52,9 @@ dir = "python"
# Bitbucket settings are similar to those for GitHub.
[bitbucket]
-# The environment variable is CGITIZE_BITBUCKET_APP_PASSWORD.
-#app_password = "XXX"
+# Access tokens are called "app passwords" on Bitbucket.
+# The environment variable is CGITIZE_BITBUCKET_TOKEN.
+#token = "XXX"
# Contrary to GitHub, Bitbucket doesn't associate app passwords with a
# username, so you also need that (CGITIZE_BITBUCKET_USERNAME is the
# environment variable).
@@ -76,8 +77,8 @@ id = "berkeleylab/upc-runtime"
# GitLab settings are similar to those for GitHub.
[gitlab]
-# The environment variable is CGITIZE_GITLAB_ACCESS_TOKEN.
-#access_token = "XXX"
+# The environment variable is CGITIZE_GITLAB_TOKEN.
+#token = "XXX"
# Similar to Bitbucket, GitLab doesn't associate access tokens with a username,
# so you also need that (CGITIZE_GITLAB_USERNAME is the environment variable).
#username = "your-username"