File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9393 echo "No theme momentum changes to commit."
9494 else
9595 git commit -m "Update theme momentum snapshot [skip ci]"
96- git push
96+ push_log="$(mktemp)"
97+ if git push 2>"${push_log}"; then
98+ rm -f "${push_log}"
99+ else
100+ if grep -Fq 'GH013: Repository rule violations found for refs/heads/main' "${push_log}" && grep -Eqi 'required status check' "${push_log}"; then
101+ echo "Push blocked by repository rules; keeping artifact-only output."
102+ cat "${push_log}"
103+ rm -f "${push_log}"
104+ else
105+ cat "${push_log}" >&2
106+ rm -f "${push_log}"
107+ exit 1
108+ fi
109+ fi
97110 fi
98111 - name : Upload theme momentum artifact
99112 uses : actions/upload-artifact@v7
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ from pathlib import Path
4+
5+
6+ def test_theme_momentum_snapshot_workflow_tolerates_repo_rule_push_rejection () -> None :
7+ workflow = Path (".github/workflows/theme_momentum_snapshot.yml" ).read_text (encoding = "utf-8" )
8+
9+ assert "Push blocked by repository rules; keeping artifact-only output." in workflow
10+ assert "GH013: Repository rule violations found for refs/heads/main" in workflow
11+ assert "grep -Eqi 'required status check' \" ${push_log}\" " in workflow
12+ assert "GH013|repository rule violations|required status check" not in workflow
13+ assert "git push 2>\" ${push_log}\" " in workflow
You can’t perform that action at this time.
0 commit comments