fix: stamp _repo into github-repo commit payloads for project attribution

The /repos/{owner}/{repo}/commits endpoint doesn't include repo info
in its response. Without _repo in the payload, these commits were
invisible to the projects query. Add _repo to parse_commit and include
it in the COALESCE chain for github source repo extraction.

After deploy, reset github-repo poller state to re-ingest with _repo:
  DELETE FROM poller_state WHERE source LIKE 'github-repo%';

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 17:59:31 +03:00
parent 03c816d2d3
commit 45fd45f5da
2 changed files with 8 additions and 2 deletions

View File

@@ -244,13 +244,18 @@ fn parse_commit(item: &Value, repo: &Repo) -> Option<Event> {
.ok()?
.with_timezone(&Utc);
let mut payload = item.clone();
if let Some(obj) = payload.as_object_mut() {
obj.insert("_repo".into(), Value::String(repo.full_name.clone()));
}
Some(Event {
id: format!("github-commit:{sha}"),
source: Source::Github,
action: "Commit".into(),
occurred_at,
public: !repo.private,
payload: item.clone(),
payload,
})
}

View File

@@ -145,7 +145,8 @@ impl EventReader for PgStore {
CASE source
WHEN 'github' THEN COALESCE(
payload->'repo'->>'name',
payload->'repository'->>'full_name'
payload->'repository'->>'full_name',
payload->>'_repo'
)
WHEN 'gitea' THEN COALESCE(
payload->'repo'->>'full_name',