-
Notifications
You must be signed in to change notification settings - Fork 0
Convert issue templates to YAML forms, fix label sync quoting bug #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #!/usr/bin/env python3 | ||
| """Validate live GitHub labels against the canonical labels/*.yml files. | ||
|
|
||
| For every muxlang repo, fetches the live label set with `gh` and diffs it | ||
| against labels/labels.yml plus the repo's overlay (labels/<repo>.yml). | ||
| Reports labels that are MISSING (canonical but not live), EXTRA (live but | ||
| not canonical), or DRIFTED (color or description differs). | ||
|
|
||
| Usage: ./scripts/validate-labels.py [repo ...] | ||
| Exits nonzero if any repo diverges. Requires gh (authenticated) and python3. | ||
| """ | ||
| import json | ||
| import re | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| ROOT = Path(__file__).resolve().parent.parent | ||
| LABELS = ROOT / "labels" | ||
|
|
||
| ALL_REPOS = [ | ||
| "mux-compiler", "mux-runtime", "mux-website-api", | ||
| "mux-syntax-highlighting", "mux-website", "tree-sitter-mux", | ||
| "mux-context", ".github", | ||
| ] | ||
|
|
||
|
|
||
| def parse_yaml(path): | ||
| """Parse the flat '- name/color/description' label YAML (no deps).""" | ||
| labels = {} | ||
| name = color = None | ||
| for raw in path.read_text().splitlines(): | ||
| m = re.match(r'^- name:\s*(.+)$', raw) | ||
| if m: | ||
| name = m.group(1).strip().strip('"') | ||
| continue | ||
| m = re.match(r'^\s+color:\s*(.+)$', raw) | ||
| if m: | ||
| color = m.group(1).strip().strip('"') | ||
| continue | ||
| m = re.match(r'^\s+description:\s*(.*)$', raw) | ||
| if m and name and color: | ||
| labels[name] = (color.lower(), m.group(1).strip().strip('"')) | ||
| name = color = None | ||
| return labels | ||
|
|
||
|
|
||
| def live_labels(repo): | ||
| # gh api --paginate follows Link headers, so repos with more than one | ||
| # page of labels are fully covered (gh label list caps at its --limit). | ||
| out = subprocess.run( | ||
| ["gh", "api", f"repos/muxlang/{repo}/labels", "--paginate", | ||
| "--jq", ".[] | {name, color, description}"], | ||
| check=True, capture_output=True, text=True, | ||
| ).stdout | ||
| return { | ||
| l["name"]: (l["color"].lower(), l["description"] or "") | ||
| for l in (json.loads(line) for line in out.splitlines() if line) | ||
| } | ||
|
|
||
|
|
||
| def main(): | ||
| repos = sys.argv[1:] or ALL_REPOS | ||
| base = parse_yaml(LABELS / "labels.yml") | ||
| dirty = False | ||
|
|
||
| for repo in repos: | ||
| expected = dict(base) | ||
| overlay = LABELS / f"{repo}.yml" | ||
| if overlay.exists(): | ||
| expected.update(parse_yaml(overlay)) | ||
| live = live_labels(repo) | ||
|
|
||
| missing = sorted(set(expected) - set(live)) | ||
| extra = sorted(set(live) - set(expected)) | ||
| drifted = sorted( | ||
| n for n in set(expected) & set(live) if expected[n] != live[n] | ||
| ) | ||
|
|
||
| print(f"=== {repo} ===") | ||
| if not (missing or extra or drifted): | ||
| print(" OK: exact match") | ||
| continue | ||
| dirty = True | ||
| for n in missing: | ||
| print(f" MISSING : {n!r} (run sync-labels.sh {repo})") | ||
| for n in extra: | ||
| print(f" EXTRA : {n!r} (add to a labels yml or retire it)") | ||
| for n in drifted: | ||
| print(f" DRIFTED : {n!r} live={live[n]} expected={expected[n]}") | ||
|
|
||
| return 1 if dirty else 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Bug report | ||
| description: Report incorrect compiler behavior or a crash | ||
| labels: ["needs triage"] | ||
| assignees: ["DerekCorniello"] | ||
| body: | ||
| - type: textarea | ||
| id: description | ||
| attributes: | ||
| label: Description | ||
| description: What went wrong? | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: repro | ||
| attributes: | ||
| label: Steps to reproduce | ||
| value: | | ||
| 1. | ||
| 2. | ||
| 3. | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: expected | ||
| attributes: | ||
| label: Expected behavior | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: actual | ||
| attributes: | ||
| label: Actual behavior | ||
| description: Include error output if any. | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: example | ||
| attributes: | ||
| label: Minimal example | ||
| render: mux | ||
| description: Smallest Mux program that reproduces the problem. | ||
| - type: input | ||
| id: version | ||
| attributes: | ||
| label: mux --version | ||
| validations: | ||
| required: true | ||
| - type: input | ||
| id: os | ||
| attributes: | ||
| label: OS / architecture |
17 changes: 0 additions & 17 deletions
17
templates/mux-compiler/ISSUE_TEMPLATE/documentation_fix.md
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
templates/mux-compiler/ISSUE_TEMPLATE/documentation_fix.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: Documentation fix | ||
| description: Report incorrect or missing compiler documentation | ||
| labels: ["documentation", "needs triage"] | ||
| assignees: ["DerekCorniello"] | ||
| body: | ||
| - type: textarea | ||
| id: wrong | ||
| attributes: | ||
| label: What is wrong | ||
| description: Which doc, README, or error message? | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: expected | ||
| attributes: | ||
| label: Expected content | ||
| - type: textarea | ||
| id: links | ||
| attributes: | ||
| label: Links | ||
| description: File paths or URLs. |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: Feature request | ||
| description: Suggest a new language or compiler capability | ||
| labels: ["needs triage"] | ||
| assignees: ["DerekCorniello"] | ||
| body: | ||
| - type: textarea | ||
| id: problem | ||
| attributes: | ||
| label: Problem | ||
| description: What problem would this solve? | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: solution | ||
| attributes: | ||
| label: Proposed solution | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: alternatives | ||
| attributes: | ||
| label: Alternatives considered | ||
| - type: textarea | ||
| id: context | ||
| attributes: | ||
| label: Additional context |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: ADR or design proposal | ||
| description: Propose an architecture decision or cross-repo design change | ||
| labels: ["needs triage", "adr"] | ||
| assignees: ["DerekCorniello"] | ||
| body: | ||
| - type: textarea | ||
| id: problem | ||
| attributes: | ||
| label: Problem | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: proposal | ||
| attributes: | ||
| label: Proposal | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: alternatives | ||
| attributes: | ||
| label: Alternatives considered | ||
| - type: textarea | ||
| id: repos | ||
| attributes: | ||
| label: Affected repos | ||
| validations: | ||
| required: true |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.