🐛 fix(ci): inline gitea workflow bootstrap

remove the pre-checkout dependency on .gitea/ci/prepare_repo.sh
from the root workflows and inline the bootstrap logic instead.

add a regression test for workflow bootstrap ordering and register
it in the tests README.
This commit is contained in:
csh
2026-05-19 09:50:24 +08:00
parent e0b1c3ab1b
commit 588b81dae4
5 changed files with 121 additions and 65 deletions
+22
View File
@@ -0,0 +1,22 @@
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
TEST_WORKFLOW = ROOT / ".gitea" / "workflows" / "test.yml"
STANDARDS_WORKFLOW = ROOT / ".gitea" / "workflows" / "standards-check.yml"
class GiteaWorkflowBootstrapTests(unittest.TestCase):
def test_repo_workflows_do_not_call_repo_local_prepare_script_before_checkout(self):
for workflow in (TEST_WORKFLOW, STANDARDS_WORKFLOW):
text = workflow.read_text(encoding="utf-8")
with self.subTest(workflow=workflow.name):
self.assertNotIn("bash .gitea/ci/prepare_repo.sh", text)
self.assertIn('REPO_DIR="${WORKSPACE_DIR}/${REPO_NAME}"', text)
self.assertIn('git clone "$REPO_URL" "$REPO_DIR"', text)
self.assertIn('echo "REPO_DIR=$REPO_DIR" >> "$GITHUB_ENV"', text)
if __name__ == "__main__":
unittest.main()