# GITEA_TOKEN_TAXBAIK

`GITEA_TOKEN_TAXBAIK` is the local API token used to validate and optionally dispatch Gitea Actions from this workspace.

## Purpose

- Read repository metadata
- Confirm workflow access
- Optionally trigger a workflow dispatch
- Poll the latest run for evidence

## Harness

Use:

```bash
python tools/validate_gitea_token_home_v1.py
```

To dispatch the KIS collector workflow as a smoke test:

```bash
python tools/validate_gitea_token_home_v1.py --dispatch --workflow kis_data_collection.yml --ref main
```

## Expected behavior

- Without `GITEA_TOKEN_TAXBAIK`, the harness exits with `GITEA_TOKEN_TAXBAIK missing or empty`.
- With a valid token, the harness should return `gate: PASS`.
- With `--dispatch`, the harness posts a workflow dispatch and reports the latest run evidence.

## Security notes

- Do not print the token value.
- Do not commit the token into repo files.
- Treat the token as a repo-scoped write credential.

## Troubleshooting

- `401 Unauthorized`: token is missing, expired, or scoped to the wrong repository.
- `404 Not Found`: repo path or workflow filename is wrong.
- `latest_run_missing`: dispatch succeeded, but the workflow run did not appear in time; increase `--wait-seconds`.

