Manual workflow to push local provider capture files to the shared Drive folder. #2

Merged
Xeplosion merged 23 commits from dev into main 2026-08-27 04:20:54 +00:00
Owner

What changed and why

Adds a workflow to push local provider capture files (providers/*.json,
*.wip.json) out to the Drive folder that tools/capture-form/index.html
reads from and writes to. Previously, getting newly-bootstrapped skeletons
into that folder required uploading them by hand.

  • src/capture_tools/push_drive.py (new capture-push-drive CLI) — for
    each local provider file, uploads it if no same-named file exists in
    Drive yet, and skips it if one does, unless --overwrite is passed.
  • src/utils/drive_api.py — added list_folder_files() and
    update_file_content(), using the full drive scope rather than
    drive.file, since the service account isn't the one that created these
    files (a researcher's own OAuth session in the capture-form is).
  • .forgejo/workflows/push-drive.yml — manual workflow_dispatch job,
    mirroring bootstrap.yml's pattern, with overwrite and dry_run
    boolean inputs. Reuses the existing GCP_SA_KEY secret.
  • tests/test_push_drive.py — 8 tests covering create/skip/overwrite/dry-run
    behavior and partial-failure handling, with the Drive API mocked out.
  • pyproject.toml / src/capture_tools/__init__.py — register the new
    capture-push-drive console script.
  • README.md / tools/capture-form/README.md — documented the new
    workflow and pointed the old "upload by hand" note at it instead.

The skip-by-default behavior is deliberate: a file already in Drive may
hold in-progress edits or a promotion made directly in the browser tool
that haven't been pulled back into git yet, and blindly overwriting it
would destroy that work.

Closes #

How to test

  1. Ensure the service account (GCP_SA_KEY) is shared as Editor on the
    target Drive folder — this is a separate share from its read access to
    the tracking sheet.
  2. Run pytest tests/test_push_drive.py — all 8 should pass without any
    network access (the Drive API is mocked).
  3. From Actions, run Push provider files to Drive with dry_run
    checked and confirm the log lists CREATE/SKIP decisions without
    error.
  4. Run it again for real (both inputs unchecked) and confirm the new
    files appear in the Drive folder, and pre-existing ones are untouched.

Checklist

  • Tests added or updated
  • Docs updated if behaviour changed
  • PR is focused on one thing
  • No unrelated changes included

Release notes

Add a manual workflow to push local provider capture files to the shared Drive folder.

## What changed and why Adds a workflow to push local provider capture files (`providers/*.json`, `*.wip.json`) out to the Drive folder that `tools/capture-form/index.html` reads from and writes to. Previously, getting newly-bootstrapped skeletons into that folder required uploading them by hand. - `src/capture_tools/push_drive.py` (new `capture-push-drive` CLI) — for each local provider file, uploads it if no same-named file exists in Drive yet, and skips it if one does, unless `--overwrite` is passed. - `src/utils/drive_api.py` — added `list_folder_files()` and `update_file_content()`, using the full `drive` scope rather than `drive.file`, since the service account isn't the one that created these files (a researcher's own OAuth session in the capture-form is). - `.forgejo/workflows/push-drive.yml` — manual `workflow_dispatch` job, mirroring `bootstrap.yml`'s pattern, with `overwrite` and `dry_run` boolean inputs. Reuses the existing `GCP_SA_KEY` secret. - `tests/test_push_drive.py` — 8 tests covering create/skip/overwrite/dry-run behavior and partial-failure handling, with the Drive API mocked out. - `pyproject.toml` / `src/capture_tools/__init__.py` — register the new `capture-push-drive` console script. - `README.md` / `tools/capture-form/README.md` — documented the new workflow and pointed the old "upload by hand" note at it instead. The skip-by-default behavior is deliberate: a file already in Drive may hold in-progress edits or a promotion made directly in the browser tool that haven't been pulled back into git yet, and blindly overwriting it would destroy that work. ## Related issues Closes # ## How to test 1. Ensure the service account (`GCP_SA_KEY`) is shared as **Editor** on the target Drive folder — this is a separate share from its read access to the tracking sheet. 2. Run `pytest tests/test_push_drive.py` — all 8 should pass without any network access (the Drive API is mocked). 3. From Actions, run **Push provider files to Drive** with `dry_run` checked and confirm the log lists `CREATE`/`SKIP` decisions without error. 4. Run it again for real (both inputs unchecked) and confirm the new files appear in the Drive folder, and pre-existing ones are untouched. ## Checklist - [x] Tests added or updated - [x] Docs updated if behaviour changed - [x] PR is focused on one thing - [ ] No unrelated changes included ## Release notes Add a manual workflow to push local provider capture files to the shared Drive folder.
feat: added increased functionality for the Goolge API utilities.
Some checks failed
Validate capture files / validate (push) Failing after 6s
3b792fa90d
feat: source researcher and capture_datetime from REF_Sources and FORM_Retrieval_Responses.
All checks were successful
Validate capture files / validate (push) Successful in 8s
eb13857a6b
fix: source provider.name from Provider_Name column instead of leaving it a placeholder.
All checks were successful
Validate capture files / validate (push) Successful in 6s
fce71765dc
docs: add bootstrap tool guide.
All checks were successful
Validate capture files / validate (push) Successful in 7s
a228a11693
fix: added missing name update to the bootstrap Python file.
All checks were successful
Validate capture files / validate (push) Successful in 7s
de5c52d984
fix: added fixed wip files with provider.name field.
All checks were successful
Validate capture files / validate (push) Successful in 7s
0de5daaf23
chore: normalize line endings to LF and add .gitattributes.
All checks were successful
Validate capture files / validate (push) Successful in 7s
58aa3c8e63
ci: add format/lint/test check on push and pull request.
Some checks failed
CI / format (push) Successful in 12s
Validate capture files / validate (push) Successful in 7s
CI / format (pull_request) Successful in 6s
Validate capture files / validate (pull_request) Successful in 7s
CI / test (push) Has been cancelled
CI / test (pull_request) Has been cancelled
30899de525
Merge pull request 'feature/initial-capture-tooling' (#1) from feature/initial-capture-tooling into dev
Some checks failed
CI / format (push) Successful in 6s
Validate capture files / validate (push) Successful in 7s
CI / test (push) Has been cancelled
748da5ed49
Reviewed-on: #1
ci: tests in ci-python workflow now look for runner with label 'ubuntu-latest'.
All checks were successful
CI / format (push) Successful in 6s
CI / test (push) Successful in 8s
Validate capture files / validate (push) Successful in 7s
69a777e5ad
feat: add browser-based provider capture form (Drive-backed, schema v2.3).
All checks were successful
CI / format (push) Successful in 7s
CI / test (push) Successful in 7s
Validate capture files / validate (push) Successful in 7s
44cfcd9ac0
fix: correct OAuth client ID whitespace, surface popup errors, and restore token callback after silent reauth.
All checks were successful
CI / format (push) Successful in 7s
CI / test (push) Successful in 7s
Validate capture files / validate (push) Successful in 7s
5a8ad9a28b
feat: add push-drive workflow to sync local provider files to the shared Drive folder.
All checks were successful
CI / format (push) Successful in 7s
CI / test (push) Successful in 7s
Validate capture files / validate (push) Successful in 7s
7976e7b5ea
feat: add push-drive workflow to sync local provider files to the shared Drive folder.
Some checks failed
CI / format (push) Failing after 7s
CI / test (push) Successful in 7s
Validate capture files / validate (push) Successful in 7s
f2cf342b31
reformat: ran ruff format.
All checks were successful
CI / format (push) Successful in 7s
CI / test (push) Successful in 7s
Validate capture files / validate (push) Successful in 7s
CI / format (pull_request) Successful in 7s
CI / test (pull_request) Successful in 8s
Validate capture files / validate (pull_request) Successful in 7s
07e11bdba1
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
XeplosionGames/minecraft-provider-analysis!2
No description provided.