Skip to content

Commit

Permalink
Fix tagging with SSH key
Browse files Browse the repository at this point in the history
This is why #51 is really important.
  • Loading branch information
christopher-dG committed Mar 8, 2020
1 parent bd9aa6c commit 34662b2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions tagbot/action/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def config(self, key: str, val: str) -> None:

def create_tag(self, version: str, sha: str, message: str) -> None:
"""Create and push a Git tag."""
self.config("user.name", "github-actions[bot]")
self.config("user.email", "[email protected]")
self.command("tag", "-m", message, version, sha)
self.command("push", "origin", version)

Expand Down
2 changes: 0 additions & 2 deletions tagbot/action/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ def configure_gpg(self, key: str, password: Optional[str]) -> None:
warn(sign_result.stderr)
raise Abort("Testing GPG key failed")
self._git.config("user.signingKey", key_id)
self._git.config("user.name", "github-actions[bot]")
self._git.config("user.email", "[email protected]")
self._git.config("tag.gpgSign", "true")

def handle_release_branch(self, version: str) -> None:
Expand Down
11 changes: 10 additions & 1 deletion test/action/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,17 @@ def test_config():

def test_create_tag():
g = _git(command="hm")
g.config = Mock()
g.create_tag("v1", "abcdef", "log")
calls = [call("tag", "-m", "log", "v1", "abcdef"), call("push", "origin", "v1")]
calls = [
call("user.name", "github-actions[bot]"),
call("user.email", "[email protected]"),
]
g.config.assert_has_calls(calls)
calls = [
call("tag", "-m", "log", "v1", "abcdef"),
call("push", "origin", "v1"),
]
g.command.assert_has_calls(calls)


Expand Down
7 changes: 1 addition & 6 deletions test/action/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,7 @@ def test_configure_gpg(chmod, mkdtemp, GPG):
chmod.assert_called_with("gpgdir", S_IREAD | S_IWRITE | S_IEXEC)
GPG.assert_called_with(gnupghome="gpgdir", use_agent=True)
gpg.import_keys.assert_called_with("foo bar")
calls = [
call("user.signingKey", "k"),
call("user.name", "github-actions[bot]"),
call("user.email", "[email protected]"),
call("tag.gpgSign", "true"),
]
calls = [call("user.signingKey", "k"), call("tag.gpgSign", "true")]
r._git.config.assert_has_calls(calls)
r.configure_gpg("Zm9v", None)
gpg.import_keys.assert_called_with("foo")
Expand Down

0 comments on commit 34662b2

Please sign in to comment.