diff --git a/bin/publish.py b/bin/publish.py index 65ecce7f..e51eb10e 100755 --- a/bin/publish.py +++ b/bin/publish.py @@ -42,7 +42,6 @@ def configure_ssh() -> None: def on_workflow_dispatch(version: str) -> None: semver = resolve_version(version) if semver.build is not None or semver.prerelease is not None: - # TODO: It might actually be nice to properly support prereleases. raise ValueError("Only major, minor, and patch components should be set") update_pyproject_toml(semver) update_action_yml(semver) diff --git a/tagbot/action/repo.py b/tagbot/action/repo.py index 7cf9313a..5e0ccca9 100644 --- a/tagbot/action/repo.py +++ b/tagbot/action/repo.py @@ -15,7 +15,7 @@ import toml from base64 import b64decode -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from stat import S_IREAD, S_IWRITE, S_IEXEC from subprocess import DEVNULL from tempfile import mkdtemp, mkstemp @@ -949,7 +949,7 @@ def _versions(self, min_age: Optional[timedelta] = None) -> Dict[str, str]: # Get the most recent commit from before min_age. kwargs: Dict[str, str] = {} if min_age is not None: - until = datetime.now() - min_age + until = datetime.now(timezone.utc).replace(tzinfo=None) - min_age commits = self._registry.get_commits(until=until) # Get the first value like this because the iterator has no `next` method. for commit in commits: @@ -972,9 +972,8 @@ def _versions_clone(self, min_age: Optional[timedelta] = None) -> Dict[str, str] """Same as _versions, but uses a Git clone to access the registry.""" registry = self._registry_clone_dir if min_age: - # TODO: Time zone stuff? default_sha = self._git.command("rev-parse", "HEAD", repo=registry) - earliest = datetime.now() - min_age + earliest = datetime.now(timezone.utc).replace(tzinfo=None) - min_age shas = self._git.command("log", "--format=%H", repo=registry).split("\n") for sha in shas: dt = self._git.time_of_commit(sha, repo=registry) @@ -1365,7 +1364,8 @@ def new_versions(self) -> Dict[str, str]: def create_dispatch_event(self, payload: Mapping[str, object]) -> None: """Create a repository dispatch event.""" - # TODO: Remove the comment when PyGithub#1502 is published. + # Keep positional arguments for compatibility + # across supported PyGithub versions. self._repo.create_repository_dispatch("TagBot", payload) def configure_ssh(self, key: str, password: Optional[str], repo: str = "") -> None: @@ -1430,7 +1430,7 @@ def configure_gpg(self, key: str, password: Optional[str]) -> None: if sign_result.status != "signature created": logger.warning(sign_result.stderr) raise Abort("Testing GPG key failed") - # On Debian, the Git version is too old to recognize tag.gpgSign, + # On Debian, the Git version can be too old to recognize tag.gpgSign, # so the tag command will need to use --sign. self._git._gpgsign = True self._git.config("tag.gpgSign", "true") diff --git a/tagbot/web/templates/base.html b/tagbot/web/templates/base.html index 4fbfe88b..eca6c277 100644 --- a/tagbot/web/templates/base.html +++ b/tagbot/web/templates/base.html @@ -9,7 +9,7 @@