# How to update the ledger

The public page reads two generated files:

- `data/hackathons.json` — events, counts, follow-ups and the timeline
- `data/github.json` — the GitHub profile, pinned repositories and recent public activity

Do not type counts or rows into `index.html`. Change a source file, rebuild, and commit the result.

## Hackathon data

1. Refresh the register queue and the past-entries audit if new source CSVs exist. On the machine that keeps the working copies, they are read from:

   - `/workspace/earning/hackathons-2026-12-05/register-queue.csv`
   - `/workspace/earning/past-entries-audit-2026-12-05.csv`

   If those paths are missing, the script uses the sanitized copies in `data/sources/`.

2. Edit the hand-maintained files when needed:

   - `data/manual/followups.json` — a follow-up that was sent or a reply that arrived. Record only the event name, the date (Asia/Calcutta), a short request label such as "Asked for an update", and the reply state. Never add organiser names, email addresses or message bodies.
   - `data/manual/extras.json` — an entered event that is not in the CSVs, or a certificate URL once one exists.
   - `data/manual/projects.json` — the public repository link for an event.

3. From the repository root, run:

   ```bash
   python3 scripts/build_data.py
   ```

   The script writes `data/hackathons.json` and refreshes the sanitized CSVs in `data/sources/`. It will refuse to write if the output contains an email address, a wallet key, or other private strings.

4. Commit the generated JSON together with any source or manual-file changes, and push to `main`. GitHub Pages will redeploy.

## GitHub section

The GitHub section is rebuilt automatically every day by the Pages workflow, which runs `scripts/fetch_github.py` against the public GitHub API (profile, pinned or top repositories, and public events). To refresh it locally:

```bash
python3 scripts/fetch_github.py
```

A token is optional. If `GITHUB_TOKEN` is set, or `gh auth token` works, the script uses it to stay within a higher rate limit. Do not commit a token.

## Recording a certificate or a result

When a certificate is issued, add `certificate_url` on that event in `data/manual/extras.json` (name and URL must match the existing event) and rebuild. When a placement is known, add a short factual `result` note the same way, or extend the script once a dedicated results file exists. Until then the Certificates column stays as "None yet", which is intentional.

## What must never appear on the public site

University names, a city or location, a student ID, phone numbers, organiser names or email addresses, wallet private keys, or the bodies of follow-up mail.


## Daily GitHub refresh

The Pages deploy workflow lives at `docs/pages-workflow.yml`. It rebuilds
`data/github.json` from the public GitHub API and deploys the site. To enable
it, copy that file to `.github/workflows/pages.yml` and turn on GitHub Pages
from GitHub Actions. The copy cannot be added from this box, because the
logged-in GitHub token does not include the `workflow` scope.

Until that workflow is in place, Pages is served from the `main` branch, and
the GitHub section uses the committed `data/github.json`. Re-run
`python3 scripts/fetch_github.py` and push when you want a fresh snapshot.
