π OpenHands: AI-Driven Development
fix(ci): prevent issue readiness workflow from failing on not-ready issues (#16514)
K HARSHAVARDHANe25feb64687b
diff --git a/.github/scripts/tests/test_issue_readiness.py b/.github/scripts/tests/test_issue_readiness.pyindex f6d5b784d3..c84a5436cc 100644--- a/.github/scripts/tests/test_issue_readiness.py+++ b/.github/scripts/tests/test_issue_readiness.py@@ -13,6 +13,7 @@ from check_issue_readiness import (references_run_method,has_checklist_item,visible_text,+ main,BUG_LABEL,ENHANCEMENT_LABEL,)@@ -278,3 +279,120 @@ I ran `npm run dev` and saw the crash above.sections = extract_sections(body)assert {"relevant logs", "actual behavior", "acceptance criteria"} <= set(sections)assert evaluate_readiness(body, [BUG_LABEL]).ready++def test_main_json_not_ready(tmp_path, capsys, monkeypatch):+ import json+ body_file = tmp_path / "issue.md"+ body_file.write_text(BUG_BODY_NO_SCREENSHOT)+ monkeypatch.setattr(+ "sys.argv",+ [+ "check_issue_readiness.py",+ "--body-file",+ str(body_file),+ "--labels",+ "bug",+ "--json",+ ],+ )+ exit_code = main()+ assert exit_code == 1+ captured = capsys.readouterr()+ data = json.loads(captured.out)+ assert data["ready"] is False+ assert len(data["reasons"]) > 0+++def test_main_json_ready(tmp_path, capsys, monkeypatch):+ import json++ body_file = tmp_path / "issue.md"+ body_file.write_text(BUG_BODY_READY)+ monkeypatch.setattr(+ "sys.argv",+ [+ "check_issue_readiness.py",+ "--body-file",+ str(body_file),+ "--labels",+ "bug",+ "--json",+ ],+ )+ exit_code = main()+ assert exit_code == 0+ captured = capsys.readouterr()+ data = json.loads(captured.out)+ assert data["ready"] is True+ assert len(data["reasons"]) == 0+++def test_main_text_ready(tmp_path, capsys, monkeypatch):+ body_file = tmp_path / "issue.md"+ body_file.write_text(BUG_BODY_READY)+ monkeypatch.setattr(+ "sys.argv",+ [+ "check_issue_readiness.py",+ "--body-file",+ str(body_file),+ "--labels",+ "bug",+ ],+ )+ exit_code = main()+ assert exit_code == 0+ captured = capsys.readouterr()+ assert "Issue meets ready-for-dev criteria." in captured.out+++def test_main_text_not_ready(tmp_path, capsys, monkeypatch):+ body_file = tmp_path / "issue.md"+ body_file.write_text(BUG_BODY_NO_SCREENSHOT)+ monkeypatch.setattr(+ "sys.argv",+ [+ "check_issue_readiness.py",+ "--body-file",+ str(body_file),+ "--labels",+ "bug",+ ],+ )+ exit_code = main()+ assert exit_code == 1+ captured = capsys.readouterr()+ assert "Issue does not meet ready-for-dev criteria:" in captured.out+++def test_main_event_path_json_ready(tmp_path, capsys, monkeypatch):+ import json++ event_file = tmp_path / "event.json"+ event_file.write_text(+ json.dumps(+ {+ "issue": {+ "body": BUG_BODY_READY,+ "labels": [{"name": "bug"}],+ }+ }+ )+ )+ monkeypatch.setattr(+ "sys.argv",+ [+ "check_issue_readiness.py",+ "--event-path",+ str(event_file),+ "--json",+ ],+ )+ exit_code = main()+ assert exit_code == 0+ captured = capsys.readouterr()+ data = json.loads(captured.out)+ assert data["ready"] is True+ assert len(data["reasons"]) == 0++diff --git a/.github/scripts/tests/test_pr_description.py b/.github/scripts/tests/test_pr_description.pyindex b16bcf4921..0711c124fc 100644--- a/.github/scripts/tests/test_pr_description.py+++ b/.github/scripts/tests/test_pr_description.py@@ -19,7 +19,6 @@ from check_pr_description import (validate_bug_fix_evidence,BUG_LABEL,ENHANCEMENT_LABEL,- READY_FOR_DEV_LABEL,)diff --git a/.github/workflows/issue-readiness-check.yml b/.github/workflows/issue-readiness-check.ymlindex 3ab803794d..ad66c13d42 100644--- a/.github/workflows/issue-readiness-check.yml+++ b/.github/workflows/issue-readiness-check.yml@@ -48,7 +48,7 @@ jobs:GITHUB_EVENT_PATH: ${{ github.event_path }}run: |set -euo pipefail- python .github/scripts/check_issue_readiness.py --json > /tmp/result.json+ python .github/scripts/check_issue_readiness.py --json > /tmp/result.json || trueecho "ready=$(jq -r '.ready' /tmp/result.json)" >> "$GITHUB_OUTPUT"# Write reasons to a file so the comment step can read them# without shell-escaping multiline text.