Skip to content

Commit

Permalink
Add additional logging when tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Sep 25, 2023
1 parent 348f025 commit 7348d53
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/github.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::curl_helper::BodyExt;
use anyhow::Context;
use curl::easy::Easy;
use rsa::pkcs1::DecodeRsaPrivateKey;
use sha2::Digest;
Expand Down Expand Up @@ -132,7 +133,7 @@ impl RepositoryClient<'_> {
}

pub(crate) fn tag(&mut self, tag: CreateTag<'_>) -> anyhow::Result<()> {
#[derive(serde::Serialize)]
#[derive(Debug, serde::Serialize)]
struct CreateTagInternal<'a> {
tag: &'a str,
message: &'a str,
Expand All @@ -143,7 +144,7 @@ impl RepositoryClient<'_> {
tagger: CreateTagTaggerInternal<'a>,
}

#[derive(serde::Serialize)]
#[derive(Debug, serde::Serialize)]
struct CreateTagTaggerInternal<'a> {
name: &'a str,
email: &'a str,
Expand All @@ -159,19 +160,21 @@ impl RepositoryClient<'_> {
"https://api.github.com/repos/{repository}/git/tags",
repository = self.repo,
))?;
let request = CreateTagInternal {
tag: tag.tag_name,
message: tag.message,
object: tag.commit,
type_: "commit",
tagger: CreateTagTaggerInternal {
name: tag.tagger_name,
email: tag.tagger_email,
},
};
let created = self
.client
.with_body(CreateTagInternal {
tag: tag.tag_name,
message: tag.message,
object: tag.commit,
type_: "commit",
tagger: CreateTagTaggerInternal {
name: tag.tagger_name,
email: tag.tagger_email,
},
})
.send_with_response::<CreatedTag>()?;
.with_body(&request)
.send_with_response::<CreatedTag>()
.with_context(|| format!("tag request {:?}", request))?;

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

Expand Down

0 comments on commit 7348d53

Please sign in to comment.