Skip to content

Commit fd84489

Browse files
Thread timestamp to tagging
This fixes a longstanding bug with GitHub tag signing where the timestamp of the created tag would differ from the signature, causing failed signature verification.
1 parent fe64d90 commit fd84489

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/github.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ impl RepositoryClient<'_> {
147147
struct CreateTagTaggerInternal<'a> {
148148
name: &'a str,
149149
email: &'a str,
150+
date: String,
150151
}
151152

152153
#[derive(serde::Deserialize)]
@@ -167,6 +168,8 @@ impl RepositoryClient<'_> {
167168
tagger: CreateTagTaggerInternal {
168169
name: tag.tagger_name,
169170
email: tag.tagger_email,
171+
// ISO 8601 format
172+
date: tag.timestamp.format("%Y-%m-%dT%H:%M:%S%Z").to_string(),
170173
},
171174
};
172175
let created = self
@@ -521,6 +524,7 @@ pub(crate) struct CreateTag<'a> {
521524
pub(crate) message: &'a str,
522525
pub(crate) tagger_name: &'a str,
523526
pub(crate) tagger_email: &'a str,
527+
pub(crate) timestamp: chrono::DateTime<chrono::Utc>,
524528
}
525529

526530
#[derive(serde::Deserialize)]

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ impl Context {
835835
let tag_name = version.to_owned();
836836
let username = "rust-lang/promote-release";
837837
let email = "release-team@rust-lang.org";
838-
let message = signer.git_signed_tag(
838+
let (message, timestamp) = signer.git_signed_tag(
839839
commit,
840840
&tag_name,
841841
username,
@@ -846,10 +846,10 @@ impl Context {
846846
github.token(repository)?.tag(CreateTag {
847847
commit,
848848
tag_name: &tag_name,
849-
// FIXME: we need to pass the timestamp too
850-
message: &message.0,
849+
message: &message,
851850
tagger_name: username,
852851
tagger_email: email,
852+
timestamp,
853853
})?;
854854

855855
Ok(())

0 commit comments

Comments
 (0)