Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
that label the test fails until you look up the new image's `python3`
(actions/runner-images) and update `RUNNER_IMAGE_PYTHON`, `RUNNER_PYTHON` and
`ruff.toml` together.
- `test_moderate_labels.py` — checks that every `create "<name>" "<color>"
"<description>"` line in `../workflows/moderate-setup.yml` has a description
of at most 100 characters (GitHub answers HTTP 422 to a longer one, and only
the manually dispatched workflow would ever show it); `scripts-tests` runs it.
- `verify_release_tag.sh` — the `release` job's check that an already
published release's tag points at the commit the run built (fails closed;
retries only transient lookup errors, six attempts over about two
Expand Down
34 changes: 34 additions & 0 deletions .github/scripts/test_moderate_labels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Guard: every label `moderate-setup.yml` creates has a description GitHub accepts.

`gh label create` fails with HTTP 422 when a description is longer than 100
characters, and only the manually dispatched workflow ever runs it, so the
limit is checked here.
"""

from __future__ import annotations

import re
import unittest
from pathlib import Path

WORKFLOW = Path(__file__).resolve().parent.parent / "workflows" / "moderate-setup.yml"
MAX_DESCRIPTION = 100 # GitHub's label description limit, in characters
CREATE_LINE = re.compile(r'^\s*create\s+"([^"]+)"\s+"([^"]+)"\s+"([^"]*)"\s*$', re.MULTILINE)


class ModerateLabelsTest(unittest.TestCase):
def test_label_descriptions_fit_githubs_limit(self) -> None:
text = WORKFLOW.read_text(encoding="utf-8")
labels = CREATE_LINE.findall(text)
self.assertTrue(labels, "no create lines parsed from moderate-setup.yml")
for name, _color, description in labels:
with self.subTest(label=name):
self.assertLessEqual(
len(description),
MAX_DESCRIPTION,
f"{name!r} description is {len(description)} characters",
)


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion .github/template-sync-state.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"template_repo": "craftainer/template-base",
"synced_tag": "v1.14.0"
"synced_tag": "v1.14.2"
}
2 changes: 1 addition & 1 deletion .github/workflows/moderate-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
create "enhancement:plan-ready" "c5def5" "Feature triage pushed a plan doc, awaiting a maintainer's enhancement:confirm label"
create "enhancement:confirm" "c5def5" "Maintainer action: confirm the plan and start the build (removed when the build run starts)"
create "enhancement:built" "c5def5" "Build PR opened, awaiting human review/merge"
create "claude:ok" "0e8a16" "Maintainer opt-in: run the moderation pipeline for this issue despite the reporter not being a collaborator"
create "claude:ok" "0e8a16" "Maintainer opt-in: moderate this issue although the reporter is not a collaborator"
create "needs-human" "b60205" "The moderation pipeline got stuck and needs a maintainer"