🐛 fix(ci): restore workflow-run commit verification
This commit is contained in:
@@ -228,44 +228,36 @@ class ThirdpartySkillsPipelineTests(unittest.TestCase):
|
||||
self.assertIn("update_thirdparty_snapshots", text)
|
||||
self.assertIn("sync_thirdparty_skills", text)
|
||||
|
||||
def test_scheduled_prepare_calls_updater_without_an_independent_entry(self):
|
||||
def test_schedule_runs_updater_without_changing_prepare_run_shape(self):
|
||||
prepare_text = PREPARE_WORKFLOW.read_text(encoding="utf-8")
|
||||
updater_text = WORKFLOW.read_text(encoding="utf-8")
|
||||
|
||||
self.assertEqual(workflow_mapping_keys(prepare_text, "jobs"), ["prepare"])
|
||||
self.assertEqual(
|
||||
workflow_mapping_keys(prepare_text, "jobs"),
|
||||
["prepare", "update_thirdparty_scheduled"],
|
||||
workflow_mapping_keys(prepare_text, "on"),
|
||||
["push", "pull_request", "workflow_dispatch"],
|
||||
)
|
||||
self.assertEqual(
|
||||
workflow_mapping_keys(updater_text, "on"),
|
||||
["workflow_call", "workflow_run"],
|
||||
["schedule", "workflow_run"],
|
||||
)
|
||||
self.assertIn(" needs: prepare", prepare_text)
|
||||
self.assertIn(" if: ${{ github.event_name == 'schedule' }}", prepare_text)
|
||||
self.assertIn(
|
||||
" uses: ./.gitea/workflows/update-thirdparty-skills.yml",
|
||||
prepare_text,
|
||||
)
|
||||
self.assertIn(" source_branch: ${{ github.ref_name }}", prepare_text)
|
||||
self.assertIn(" source_sha: ${{ github.sha }}", prepare_text)
|
||||
self.assertIn(" WORKFLOW: ${{ secrets.WORKFLOW }}", prepare_text)
|
||||
self.assertIn(" workflow_call:", updater_text)
|
||||
self.assertIn(" source_branch:", updater_text)
|
||||
self.assertIn(" source_sha:", updater_text)
|
||||
self.assertIn(" WORKFLOW:", updater_text)
|
||||
self.assertIn(" required: true", updater_text)
|
||||
self.assertIn(
|
||||
"SOURCE_BRANCH: ${{ inputs.source_branch || "
|
||||
"github.event.workflow_run.head_branch }}",
|
||||
updater_text,
|
||||
)
|
||||
self.assertIn(
|
||||
"SOURCE_SHA: ${{ inputs.source_sha || "
|
||||
"github.event.workflow_run.head_sha }}",
|
||||
updater_text,
|
||||
)
|
||||
self.assertIn("github.event_name == 'workflow_call' ||", updater_text)
|
||||
self.assertIn("github.event.workflow_run.event != 'schedule'", updater_text)
|
||||
self.assertNotIn("update_thirdparty_scheduled", prepare_text)
|
||||
self.assertNotIn("uses: ./.gitea/workflows/", prepare_text)
|
||||
self.assertNotIn(" schedule:", prepare_text)
|
||||
self.assertNotIn(" workflow_call:", updater_text)
|
||||
self.assertIn(' - cron: "0 22 * * *"', updater_text)
|
||||
self.assertIn("github.event_name == 'schedule' ||", updater_text)
|
||||
self.assertNotIn("github.event.workflow_run.event != 'schedule'", updater_text)
|
||||
self.assertIn('SOURCE_BRANCH="$GITHUB_REF_NAME"', updater_text)
|
||||
self.assertIn('SOURCE_SHA="$GITHUB_SHA"', updater_text)
|
||||
self.assertIn('SOURCE_BRANCH="${{ github.event.workflow_run.head_branch }}"', updater_text)
|
||||
self.assertIn('SOURCE_SHA="${{ github.event.workflow_run.head_sha }}"', updater_text)
|
||||
self.assertIn('echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> "$GITHUB_ENV"', updater_text)
|
||||
self.assertIn('echo "SOURCE_SHA=$SOURCE_SHA" >> "$GITHUB_ENV"', updater_text)
|
||||
self.assertIn('HEAD_SHA="$SOURCE_SHA"', updater_text)
|
||||
self.assertIn('checkout --detach --force "${SOURCE_SHA:-}"', updater_text)
|
||||
self.assertIn('git init --bare "$REPOSITORY_DIR"', updater_text)
|
||||
self.assertIn("'+refs/heads/*:refs/remotes/origin/*'", updater_text)
|
||||
|
||||
def test_inline_workflow_exposes_manifest_and_publish_contract(self):
|
||||
text = WORKFLOW.read_text(encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user