DEVX-106: feat: detect badge commits as automated CI commits
Post-merge / detect-type (push) Successful in 8s
Post-merge / validate-commit-msg (push) Successful in 9s
Post-merge / vikunja (push) Successful in 21s
Post-merge / configure-repo (push) Successful in 13s
Build Images / detect-type (push) Successful in 40s
Post-merge / sync-wiki (push) Successful in 36s
Post-merge / release (push) Successful in 39s
Post-merge / badges (push) Successful in 45s
Post-merge / publish (push) Successful in 18s
Build Images / build-and-push (push) Successful in 3m1s
Build Images / cleanup (push) Successful in 2m47s

This commit was merged in pull request #163.
This commit is contained in:
2026-07-01 06:19:34 +00:00
parent 3dd5b452c0
commit c0fcaef25f
3 changed files with 76 additions and 4 deletions
+48 -2
View File
@@ -38,6 +38,31 @@ class TestIsReleaseCommit:
assert detect_release_commit.is_release_commit("") is False
class TestIsBadgeCommit:
def test_badge_commit(self) -> None:
assert detect_release_commit.is_badge_commit("chore: update badge URLs to commit abc123 [skip ci]") is True
def test_regular_chore(self) -> None:
assert detect_release_commit.is_badge_commit("chore: cleanup deps") is False
def test_empty(self) -> None:
assert detect_release_commit.is_badge_commit("") is False
class TestIsAutomatedCommit:
def test_release_is_automated(self) -> None:
assert detect_release_commit.is_automated_commit("release: v1.0.0 [skip ci]") is True
def test_badge_is_automated(self) -> None:
assert detect_release_commit.is_automated_commit("chore: update badge URLs to commit abc123 [skip ci]") is True
def test_regular_is_not_automated(self) -> None:
assert detect_release_commit.is_automated_commit("OBL-INFRA-363: fix: something") is False
def test_empty(self) -> None:
assert detect_release_commit.is_automated_commit("") is False
class TestWriteGithubOutput:
def test_write(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
gh_file = tmp_path / "output.txt"
@@ -62,7 +87,26 @@ class TestMain:
assert result.exit_code == 0
assert "Release commit" in result.output
with open(gh_file) as f:
assert "is-release=true" in f.read()
content = f.read()
assert "is-release=true" in content
assert "is-automated=true" in content
def test_badge_commit(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
gh_file = tmp_path / "output.txt"
monkeypatch.setenv("GITHUB_OUTPUT", str(gh_file))
with patch.object(
detect_release_commit,
"get_commit_message",
return_value="chore: update badge URLs to commit abc123 [skip ci]",
):
runner = CliRunner()
result = runner.invoke(detect_release_commit.main, [])
assert result.exit_code == 0
assert "Automated CI commit" in result.output
with open(gh_file) as f:
content = f.read()
assert "is-release=false" in content
assert "is-automated=true" in content
def test_regular_commit(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
gh_file = tmp_path / "output.txt"
@@ -73,4 +117,6 @@ class TestMain:
assert result.exit_code == 0
assert "Regular merge commit" in result.output
with open(gh_file) as f:
assert "is-release=false" in f.read()
content = f.read()
assert "is-release=false" in content
assert "is-automated=false" in content