Move the sync script out of the scoped workflow into a file (MIL-004 task 6, part 1) #74

Merged
Tirsvad merged 1 commits from mil-004-sync-script-as-file into main 2026-10-10 14:31:24 +02:00
Owner

Moves the sync script out of the scoped workflow into a file: the first half of MIL-004 task 6 (issue #69). The publisher follows in a second pull request.

Changes

  • tools/sync_github_metadata.py: the 221 lines that were embedded in sync-github-metadata.yml, unchanged in behaviour and messages, with a docstring that lists its environment variables.
  • .gitea/scoped_workflows/sync-github-metadata.yml: 230 lines down to 33. It checks out TirSystem/github-action at main into shared-scripts and runs python3 shared-scripts/tools/sync_github_metadata.py with the same four environment variables. The repository is public, so no token is needed for the checkout.
  • Tests (189 pass): tests/workflow_source.py imports the script file, with a wrapper so the existing tests of the script are unchanged; tests/test_workflows.py asserts that the workflow embeds no script, checks out this repository and runs the file, and that the script compiles and has a main.

Verified live

From TirSystem-BashScript/RepoFoundry (another organization) with that organization's real secrets, on throwaway branches (deleted): a thin workflow that fetched the script file ran Preflight passed: Gitea and GitHub accepted the credentials. and Synced description and topics to TirSystem-BashScript/RepoFoundry.

Risk, and how to merge it

This changes what repositories in all four organizations run on their next push to main. If the checkout failed there, their sync would fail. The checkout of this repository was already proven from two organizations and the thin workflow ran live, but I would merge this first, watch the first consumer runs, and only then move the publisher.

Two properties to know:

  • every consumer runs whatever main of this repository holds (the same trust as scoped delivery today); MIL-004 task 1 defines how a consumer pins a tag;
  • if this repository became private, the checkout would need a token.

Not in this pull request

  • The publisher (publish-wiki.yml, about 310 lines) still embeds its script.
  • README and wiki: nothing changes yet; the README still says "the Python embedded in them", which stays true until the publisher moves.

Refs #69

Moves the sync script out of the scoped workflow into a file: the first half of MIL-004 task 6 (issue #69). The publisher follows in a second pull request. ## Changes - `tools/sync_github_metadata.py`: the 221 lines that were embedded in `sync-github-metadata.yml`, unchanged in behaviour and messages, with a docstring that lists its environment variables. - `.gitea/scoped_workflows/sync-github-metadata.yml`: 230 lines down to 33. It checks out `TirSystem/github-action` at `main` into `shared-scripts` and runs `python3 shared-scripts/tools/sync_github_metadata.py` with the same four environment variables. The repository is public, so no token is needed for the checkout. - Tests (189 pass): `tests/workflow_source.py` imports the script file, with a wrapper so the existing tests of the script are unchanged; `tests/test_workflows.py` asserts that the workflow embeds no script, checks out this repository and runs the file, and that the script compiles and has a `main`. ## Verified live From `TirSystem-BashScript/RepoFoundry` (another organization) with that organization's real secrets, on throwaway branches (deleted): a thin workflow that fetched the script file ran `Preflight passed: Gitea and GitHub accepted the credentials.` and `Synced description and topics to TirSystem-BashScript/RepoFoundry.` ## Risk, and how to merge it This changes what repositories in all four organizations run on their next push to `main`. If the checkout failed there, their sync would fail. The checkout of this repository was already proven from two organizations and the thin workflow ran live, but I would merge this first, watch the first consumer runs, and only then move the publisher. Two properties to know: - every consumer runs whatever `main` of this repository holds (the same trust as scoped delivery today); MIL-004 task 1 defines how a consumer pins a tag; - if this repository became private, the checkout would need a token. ## Not in this pull request - The publisher (`publish-wiki.yml`, about 310 lines) still embeds its script. - README and wiki: nothing changes yet; the README still says "the Python embedded in them", which stays true until the publisher moves. Refs #69
Tirsvad added 1 commit 2026-10-10 14:30:48 +02:00
Move the sync script out of the scoped workflow into a file
Validate workflows / validate (pull_request) Successful in 16s
ac20d1c2a1
tools/sync_github_metadata.py holds the 221 lines that were embedded in
sync-github-metadata.yml, unchanged in behaviour and messages. The scoped
workflow now checks out TirSystem/github-action at main and runs the file
(33 lines instead of 230). The tests import the file instead of executing
the YAML. Verified live from TirSystem-BashScript/RepoFoundry with that
organisation's secrets.

Task: MIL-004#6
Tirsvad merged commit e6db4b56d3 into main 2026-10-10 14:31:24 +02:00
Tirsvad deleted branch mil-004-sync-script-as-file 2026-10-10 14:31:24 +02:00
Sign in to join this conversation.