Skip to content

Commit 72abfa6

Browse files
committed
add logging and safety to enum-->string
1 parent bb0ef88 commit 72abfa6

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/github_issue.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ impl From<Action> for String {
2020
Action::List => String::from("List"),
2121
Action::Read => String::from("Read"),
2222
Action::Update => String::from("Update"),
23+
_ => String::from("Unknown"),
2324
}
2425
}
2526
}
@@ -120,7 +121,9 @@ impl<'issue> Issue<'issue> {
120121
}),
121122
None => octocrab::Octocrab::default(),
122123
};
124+
log::debug!("built octocrab client");
123125
let issues = client.issues(self.owner, self.repo);
126+
log::debug!("built octocrab issues");
124127
// execute action and assign returned issue
125128
let issue = match action {
126129
// create an issue
@@ -132,6 +135,7 @@ impl<'issue> Issue<'issue> {
132135
// update an issue
133136
Action::Update => self.update(issues).await?,
134137
};
138+
log::debug!("issue interfacing completed");
135139

136140
Ok(issue)
137141
}
@@ -161,6 +165,8 @@ impl<'issue> Issue<'issue> {
161165
if self.milestone.is_some() {
162166
issue = issue.milestone(self.milestone);
163167
}
168+
169+
log::debug!("creating issue");
164170
// send and await the issue
165171
match issue.send().await {
166172
// return created issue
@@ -190,6 +196,7 @@ impl<'issue> Issue<'issue> {
190196
match self.number {
191197
// issue number specified
192198
Some(number) => {
199+
log::debug!("reading issue");
193200
// retrieve the issue with the handler
194201
match issues.get(number).await {
195202
Ok(issue) => return Ok(issue),
@@ -245,6 +252,8 @@ impl<'issue> Issue<'issue> {
245252
let labels = self.labels.clone().unwrap();
246253
issue_page = issue_page.labels(&labels[..]);
247254
}*/
255+
256+
log::debug!("listing issues");
248257
// send and await the issue page
249258
let page = match issue_page.send().await {
250259
// return issue pages
@@ -306,6 +315,8 @@ impl<'issue> Issue<'issue> {
306315
if self.milestone.is_some() {
307316
issue = issue.milestone(self.milestone.unwrap());
308317
}
318+
319+
log::debug!("updating issue");
309320
// send and await the issue
310321
match issue.send().await {
311322
// return updated issue

src/main.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ impl concourse_resource::Resource for GithubIssue {
6666
panic!("the check step was unable to return a github issue from the source values");
6767
}
6868
};
69-
log::info!("the github issue information was successfully retrieved");
69+
log::info!(
70+
"the github issue information was successfully retrieved for number {}",
71+
issue.number
72+
);
7073

7174
// return one sized version vector if issue is open and two sized if closed
7275
match issue.state {
@@ -141,7 +144,11 @@ impl concourse_resource::Resource for GithubIssue {
141144
);
142145
}
143146
};
144-
log::info!("successful {} for the github issue", String::from(action));
147+
log::info!(
148+
"successful {} for the github issue number {}",
149+
String::from(action),
150+
issue.number
151+
);
145152

146153
if source.number().is_none() {
147154
// store created issue number in file for subsequent check step

0 commit comments

Comments
 (0)