Skip to content

Commit 7348d53

Browse files
Add additional logging when tagging
1 parent 348f025 commit 7348d53

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/github.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::curl_helper::BodyExt;
2+
use anyhow::Context;
23
use curl::easy::Easy;
34
use rsa::pkcs1::DecodeRsaPrivateKey;
45
use sha2::Digest;
@@ -132,7 +133,7 @@ impl RepositoryClient<'_> {
132133
}
133134

134135
pub(crate) fn tag(&mut self, tag: CreateTag<'_>) -> anyhow::Result<()> {
135-
#[derive(serde::Serialize)]
136+
#[derive(Debug, serde::Serialize)]
136137
struct CreateTagInternal<'a> {
137138
tag: &'a str,
138139
message: &'a str,
@@ -143,7 +144,7 @@ impl RepositoryClient<'_> {
143144
tagger: CreateTagTaggerInternal<'a>,
144145
}
145146

146-
#[derive(serde::Serialize)]
147+
#[derive(Debug, serde::Serialize)]
147148
struct CreateTagTaggerInternal<'a> {
148149
name: &'a str,
149150
email: &'a str,
@@ -159,19 +160,21 @@ impl RepositoryClient<'_> {
159160
"https://api.github.com/repos/{repository}/git/tags",
160161
repository = self.repo,
161162
))?;
163+
let request = CreateTagInternal {
164+
tag: tag.tag_name,
165+
message: tag.message,
166+
object: tag.commit,
167+
type_: "commit",
168+
tagger: CreateTagTaggerInternal {
169+
name: tag.tagger_name,
170+
email: tag.tagger_email,
171+
},
172+
};
162173
let created = self
163174
.client
164-
.with_body(CreateTagInternal {
165-
tag: tag.tag_name,
166-
message: tag.message,
167-
object: tag.commit,
168-
type_: "commit",
169-
tagger: CreateTagTaggerInternal {
170-
name: tag.tagger_name,
171-
email: tag.tagger_email,
172-
},
173-
})
174-
.send_with_response::<CreatedTag>()?;
175+
.with_body(&request)
176+
.send_with_response::<CreatedTag>()
177+
.with_context(|| format!("tag request {:?}", request))?;
175178

176179
self.create_ref(&format!("refs/tags/{}", tag.tag_name), &created.sha)?;
177180

0 commit comments

Comments
 (0)