Skip to content

Commit 6f8b8d8

Browse files
tusharshah21joelamouche
authored andcommitted
feat: add per-issue tracing logs and update env.example with GitHub vars
1 parent 5d469ab commit 6f8b8d8

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

backend/.env.example

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,13 @@ JWT_SECRET=your-super-secret-jwt-key-change-in-production
99
JWT_EXPIRATION=86400
1010

1111
# Admin Configuration (comma-separated wallet addresses)
12-
# ADMIN_ADDRESSES=0xYourAdminAddress1,0xAnotherAdminAddress2
12+
# ADMIN_ADDRESSES=0xYourAdminAddress1,0xAnotherAdminAddress2
13+
14+
# GitHub Integration (required for /admin/github/sync)
15+
# Create a PAT at https://github.com/settings/tokens with public_repo scope
16+
GITHUB_TOKEN=your_github_pat_here
17+
GITHUB_OWNER=TheSoftwareDevGuild
18+
GITHUB_API_URL=https://api.github.com
19+
20+
# Set to 1 to skip SIWE signature verification (local testing only, never in production)
21+
# TEST_MODE=1

backend/src/application/commands/sync_github_issues.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::sync::Arc;
22

33
use regex::Regex;
4+
use tracing::{debug, info};
45

56
use crate::domain::{
67
entities::github_issue::GithubIssue,
@@ -87,14 +88,19 @@ pub async fn sync_github_issues(
8788
let mut total_synced: usize = 0;
8889

8990
for repo in &repos {
91+
info!(repo = %repo, "Fetching issues from GitHub");
9092
let (repo_id, api_issues) = github_service
9193
.fetch_issues(repo, since.as_deref())
9294
.await
9395
.map_err(|e| format!("Failed to fetch issues for {repo}: {e}"))?;
9496

97+
info!(repo = %repo, count = api_issues.len(), "Fetched issues from GitHub API");
98+
99+
let mut repo_synced: usize = 0;
95100
for api_issue in &api_issues {
96101
// Ignore PRs
97102
if api_issue.pull_request.is_some() {
103+
debug!(repo = %repo, issue = api_issue.number, "Skipping pull request");
98104
continue;
99105
}
100106

@@ -105,8 +111,20 @@ pub async fn sync_github_issues(
105111
.await
106112
.map_err(|e| format!("Failed to upsert issue {}: {e}", api_issue.id))?;
107113

108-
total_synced += 1;
114+
info!(
115+
repo = %repo,
116+
issue_number = issue.issue_number,
117+
title = %issue.title,
118+
state = %issue.state,
119+
points = issue.points,
120+
"Synced issue"
121+
);
122+
123+
repo_synced += 1;
109124
}
125+
126+
info!(repo = %repo, synced = repo_synced, "Finished syncing repo");
127+
total_synced += repo_synced;
110128
}
111129

112130
Ok(total_synced)

backend/src/presentation/handlers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ pub async fn github_sync_handler(
331331
.into_response();
332332
}
333333

334+
tracing::info!(repos = ?request.repos, since = ?request.since, "Starting GitHub issue sync");
335+
334336
match sync_github_issues(
335337
state.github_service.clone(),
336338
state.github_issue_repository.clone(),

0 commit comments

Comments
 (0)