🐛 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
+1
View File
@@ -10,6 +10,7 @@ tests/
├── cli/ # Python CLI 测试(unittest
│ └── test_playbook_cli.py # playbook.py 基础功能测试
├── test_format_md_action.py # format_md 动作测试
├── test_gitea_workflow_bootstrap.py # Gitea workflow 自举顺序回归测试
├── test_firstparty_skills_quality.py # first-party skills 元数据与结构质量测试
├── test_gitattributes_modes.py # gitattr_mode 行为测试
├── test_no_backup_flags.py # no_backup 行为测试
+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()