Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci: a push to a feature branch is not a workflow's state (CUA-2227) (#5903)

cua-agents[bot]61b3cae5cea4
diff --git a/.github/scripts/tests/test_workflow_alerts.py b/.github/scripts/tests/test_workflow_alerts.py
index eb4515f4f4..7567f6cf27 100644
--- a/.github/scripts/tests/test_workflow_alerts.py
+++ b/.github/scripts/tests/test_workflow_alerts.py
@@ -92,9 +92,15 @@ class Eligible(unittest.TestCase):
for tag in ("cua-spaces-v0.15.0", "cua-driver-rs-v0.38.0", "lume-v0.6.2-nightly.20261015"):
self.assertTrue(wa.eligible(run(event="workflow_dispatch", branch=tag), "trycua/cua", "main"), tag)
- def test_pushes_count_on_any_ref_so_release_tags_alert(self):
+ def test_pushes_to_the_default_branch_and_to_release_tags_count(self):
+ self.assertTrue(wa.eligible(run(event="push", branch="main"), "trycua/cua", "main"))
self.assertTrue(wa.eligible(run(event="push", branch="cua-driver-rs-v0.3.1"), "trycua/cua", "main"))
+ def test_a_push_to_a_feature_branch_is_not_the_pipelines_state(self):
+ # A branch push that breaks a workflow file shows up as a failed run named after the file path.
+ for branch in ("agent/cua-2227-staging-alerts", "dillon/cua-1759-oom-stop-reason", "fix-bug"):
+ self.assertFalse(wa.eligible(run(event="push", branch=branch), "trycua/cua", "main"), branch)
+
def test_pull_requests_and_forks_never_alert(self):
self.assertFalse(wa.eligible(run(event="pull_request"), "trycua/cua", "main"))
self.assertFalse(wa.eligible(run(repo="someone/cua"), "trycua/cua", "main"))
diff --git a/.github/scripts/workflow_alerts.py b/.github/scripts/workflow_alerts.py
index 83bced410e..9adf78ea3c 100644
--- a/.github/scripts/workflow_alerts.py
+++ b/.github/scripts/workflow_alerts.py
@@ -41,7 +41,7 @@ FIRING = {"failure", "timed_out", "startup_failure"}
RESOLVED = {"success"}
# Triggers nobody is watching live. A pull_request run (a fork's too) never alerts.
EVENTS = {"schedule", "push", "repository_dispatch", "workflow_dispatch"}
-# A release gate is re-run by dispatching the workflow on its tag (cua-spaces-v0.15.0).
+# A release run is a push of its tag, and the gate is re-run by dispatching the workflow on it (cua-spaces-v0.15.0).
RELEASE_REF = re.compile(r"[A-Za-z0-9_.]+(?:-[A-Za-z0-9_.]+)*-v\d+\.\d+[A-Za-z0-9._+-]*")
WHY = {
"failure": "a job failed",
@@ -69,7 +69,9 @@ def state_of(conclusion: str | None) -> str | None:
def eligible(run: dict, repo: str, default_branch: str) -> bool:
- """A run of this repository: any push (tags included), a dispatch on a release tag, or any run on the default branch."""
+ """A run that says something about the workflow's real state: of this repository, and either on the default
+ branch or a push or dispatch on a release tag (cua-spaces-v0.15.0). A push to a feature branch, even one that
+ breaks the workflow file, is not the pipeline's state."""
head_repo = (run.get("head_repository") or {}).get("full_name")
if head_repo and head_repo != repo:
return False
@@ -77,7 +79,9 @@ def eligible(run: dict, repo: str, default_branch: str) -> bool:
if event not in EVENTS:
return False
branch = run.get("head_branch") or ""
- return event == "push" or branch == default_branch or (event == "workflow_dispatch" and RELEASE_REF.fullmatch(branch) is not None)
+ if branch == default_branch:
+ return True
+ return event in ("push", "workflow_dispatch") and RELEASE_REF.fullmatch(branch) is not None
def iso(moment: dt.datetime) -> str: