Skip to content
Open
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
1 change: 0 additions & 1 deletion bin/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions tagbot/action/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions tagbot/web/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

<body>
<div id="header">
<!-- TODO HEADER -->
<h1>TagBot</h1>
</div>

<div id="content">
{% block content %}{% endblock %}
</div>

<div id="footer">
<!-- TODO FOOTER -->
<small><a href="https://github.com/JuliaRegistries/TagBot">Source</a></small>
</div>
</body>
</html>
6 changes: 5 additions & 1 deletion test/action/test_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ def test_collect_data():
c._is_backport = Mock(return_value=False)
commit = Mock(author=Mock(date=datetime.now(timezone.utc)))
c._repo._repo.get_commit = Mock(return_value=Mock(commit=commit))
# TODO: Put stuff here.
c._issues = Mock(return_value=[])
c._pulls = Mock(return_value=[])
c._custom_release_notes = Mock(return_value="custom")
Expand All @@ -332,6 +331,11 @@ def test_collect_data():
"version_url": "https://github.com/A/B.jl/tree/v1.2.3",
"yanked": False,
}
c._repo._repo.get_commit.assert_called_with("abcdef")
c._issues.assert_called_once()
c._pulls.assert_called_once()
c._custom_release_notes.assert_called_with("v1.2.3")
c._is_backport.assert_called_with("v1.2.3")
data = c._collect_data("v2.3.4", "bcdefa")
assert data["compare_url"] is None
assert data["previous_release"] is None
Expand Down
7 changes: 3 additions & 4 deletions test/action/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,10 +918,9 @@ def test_is_registered():
assert r.is_registered()
contents.decoded_content = b"""repo = "git@github.com:Foo/Bar.jl.git"\n"""
assert not r.is_registered()
contents.decoded_content = b"""repo = "https://GH.COM/Foo/Bar.jl"\n"""
assert r.is_registered()
# TODO: We should test for the InvalidProject behaviour,
# but I'm not really sure how it's possible.
with patch.object(type(r), "_registry_path", new_callable=PropertyMock) as root:
root.side_effect = InvalidProject("bad project")
assert not r.is_registered()


def test_new_versions():
Expand Down