Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ci-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail

echo "=== cargo fmt --check ==="
cargo fmt --check

echo ""
echo "=== cargo clippy -- -D warnings ==="
cargo clippy -- -D warnings

echo ""
echo "=== cargo test ==="
cargo test

echo ""
echo "All CI checks passed."
5 changes: 1 addition & 4 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,7 @@ impl App {

// Validate any stored token at startup. If the /user endpoint returns 401,
// the token is stale – clear it so subsequent requests don't carry a bad header.
let auth_user = match github.fetch_authenticated_user() {
Ok(user) => user,
Err(_) => None,
};
let auth_user: Option<String> = github.fetch_authenticated_user().unwrap_or_default();
if auth_user.is_none() && token.is_some() {
log::warn!("stored token rejected by GitHub, clearing it");
let _ = auth::clear_token();
Expand Down
6 changes: 2 additions & 4 deletions src/cli/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ pub fn resolve_full_name(repo: &str) -> Result<String> {
// ── API helpers ─────────────────────────────────────────────────────────

pub fn handle_api_error(full_name: &str, e: &anyhow::Error) -> String {
let msg = e
.downcast_ref::<GitHubError>()
e.downcast_ref::<GitHubError>()
.map(|gh_err| match gh_err {
GitHubError::Api { status, body } if *status == 404 || body.contains("Not Found") => {
format!("repository '{full_name}' not found on GitHub")
Expand All @@ -128,8 +127,7 @@ pub fn handle_api_error(full_name: &str, e: &anyhow::Error) -> String {
}
_ => format!("{gh_err}"),
})
.unwrap_or_else(|| format!("{e}"));
msg
.unwrap_or_else(|| format!("{e}"))
}

pub fn make_client() -> Result<Arc<dyn GitProvider>> {
Expand Down
Loading