mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 03:39:52 +00:00
Remove the PR template check
Delete the pr-template workflow, its checker script and tests, and the CI step that ran those tests. Update CONTRIBUTING.md and the changelog. Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
This commit is contained in:
1 parent
857c16fcf7
commit
566f803111
6 files changed
+4
-245
No files matched your search
@@ -63,8 +63,6 @@ jobs:
|
||||
run: |
|
||||
PYTHONPATH=scripts python3 -m unittest discover -s tests/agent_queue
|
||||
sh -n scripts/agent-queue.sh scripts/agent-sync.sh
|
||||
- name: Test pull request template check
|
||||
run: PYTHONPATH=scripts python3 -m unittest discover -s tests/pr_template
|
||||
- name: Test native audit JSON decoding
|
||||
run: python3 -m unittest discover -s tests/audit
|
||||
- name: Test semantic registry generator and coverage report
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
name: PR template
|
||||
|
||||
# Fails when a pull request description does not follow
|
||||
# .github/PULL_REQUEST_TEMPLATE.md: every section present and filled in, a
|
||||
# linked issue ("Closes #N" or "No linked issue: <reason>"), and the
|
||||
# claimed-first and DCO checkboxes ticked. Runs again whenever the description
|
||||
# is edited; comments never start it. Runs on the base branch: pull request
|
||||
# code is never checked out or executed, and the description is read as data.
|
||||
#
|
||||
# To make it blocking, mark the "PR template / description" check as required
|
||||
# in the branch protection rule for main.
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
description:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Check the description against the template
|
||||
run: |
|
||||
set -u
|
||||
status=0
|
||||
python3 scripts/pr_template_check.py --event "$GITHUB_EVENT_PATH" > "$RUNNER_TEMP/result.txt" || status=$?
|
||||
cat "$RUNNER_TEMP/result.txt"
|
||||
{ echo '## PR template'; cat "$RUNNER_TEMP/result.txt"; } >> "$GITHUB_STEP_SUMMARY"
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo "::error title=PR description does not follow the template::$(tail -n +2 "$RUNNER_TEMP/result.txt" | head -n -1 | tr '\n' ' ')"
|
||||
fi
|
||||
exit "$status"
|
||||
@@ -9,6 +9,9 @@ exact revision and known limitations.
|
||||
Guest execution uses original, purpose-built test programs. Commercial Xbox game execution
|
||||
remains unsupported.
|
||||
|
||||
### Removed
|
||||
- Removed the "PR template" check (`.github/workflows/pr-template.yml`, `scripts/pr_template_check.py` and its tests) and its CI test step. Pull request descriptions are no longer validated automatically; the template and the claim-first rule in CONTRIBUTING.md still apply to reviewers.
|
||||
|
||||
### Changed
|
||||
- Replaced our own references to a specific commercial game title (README non-affiliation line, research and integration notes, ignored diagnostics folder names) with generic "commercial title" wording. The ignored folder names are now `diagnostics/title-candidate-*` and `diagnostics/title-check`. Third-party repository names, URLs and code-span paths in research notes are unchanged so their provenance stays accurate. Our own prose references to the upstream project formerly named in the research notes now read "PE-Vulkan project". Added the PortWatch native-macOS research notes. No behavior change.
|
||||
- TLS setup now copies templates from 64 KiB up to 1 MiB straight into the zeroed thread data block, after checking that every template byte is readable, instead of staging them in a second buffer (#111). The pointer array and data block layout, the TLS index write and the error for an unreadable template are unchanged, and nothing is mapped when the template cannot be read. On an Apple M2 Pro, median setup time for original synthetic templates over 31 interleaved samples fell by 21.7 % at 64 KiB, 19.0 % at 256 KiB and 14.2 % at 768 KiB. Smaller and larger templates keep the single staged read and showed no change beyond run-to-run variation.
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ Before incorporating third-party code, verify per-file license compatibility wit
|
||||
## Pull requests
|
||||
|
||||
- Branch from the current main branch, keep commits focused, and link relevant issues.
|
||||
- Fill in every section of the pull request template, keep `Closes #<number>` (or write `No linked issue: <reason>`), and tick the claimed-first and DCO checkboxes. The *PR template* check fails until the description does, and runs again each time you edit it.
|
||||
- Fill in every section of the pull request template, keep `Closes #<number>` (or write `No linked issue: <reason>`). Tick the claimed-first and DCO checkboxes only if they are true.
|
||||
- Include a clear explanation, tests and any documentation/status updates. Separate unverified work from supported behavior.
|
||||
- Disclose material AI assistance and personally review generated changes. AI output is not an authoritative source, test oracle or substitute for independent review.
|
||||
- Never include secrets, personal paths, credentials or private data in patches or logs.
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Check that a pull request description follows .github/PULL_REQUEST_TEMPLATE.md.
|
||||
|
||||
Standard library only. The description is read as data from the GitHub event
|
||||
file (or a plain text file with --body-file); it is never executed.
|
||||
Exit status 0 when the description passes, 1 when something is missing.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
|
||||
SECTIONS = (
|
||||
"Summary",
|
||||
"Implementation and evidence",
|
||||
"Verification",
|
||||
"Compatibility and limitations",
|
||||
"Checklist",
|
||||
"AI assistance",
|
||||
)
|
||||
# Checklist items that must be ticked, found by the start of their text.
|
||||
REQUIRED_TICKS = (
|
||||
("I claimed the linked issue", "the claimed-first checkbox"),
|
||||
("My commits are signed off under the DCO", "the DCO sign-off checkbox"),
|
||||
)
|
||||
ISSUE_LINK = re.compile(r"\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s+#\d+", re.I)
|
||||
NO_ISSUE = re.compile(r"^\s*No linked issue:\s*\S", re.I | re.M)
|
||||
COMMENT = re.compile(r"<!--.*?-->", re.S)
|
||||
EMPTY_LINK = re.compile(r"^\s*(?:close|fix|resolve)\w*\s*#\s*$", re.I)
|
||||
HEADING = re.compile(r"^##\s+(.+?)\s*$", re.M)
|
||||
|
||||
|
||||
def sections(body):
|
||||
"""Map each level-2 heading to its text, with HTML comments removed."""
|
||||
text = COMMENT.sub("", body.replace("\r\n", "\n"))
|
||||
found = {}
|
||||
marks = list(HEADING.finditer(text))
|
||||
for i, m in enumerate(marks):
|
||||
end = marks[i + 1].start() if i + 1 < len(marks) else len(text)
|
||||
found[m.group(1).strip().lower()] = text[m.end():end].strip()
|
||||
return text, found
|
||||
|
||||
|
||||
def has_content(name, value):
|
||||
if name == "Verification":
|
||||
# The empty table from the template does not count: some cell must be filled.
|
||||
rows = [r for r in value.splitlines() if r.strip().startswith("|")]
|
||||
filled = [r for r in rows[2:] if [c for c in r.strip().strip("|").split("|")[1:] if c.strip()]]
|
||||
prose = [r for r in value.splitlines() if r.strip() and not r.strip().startswith("|")]
|
||||
return bool(filled or prose)
|
||||
if name == "Checklist":
|
||||
return "- [" in value
|
||||
# A bare "Closes #" left over from the template is not content.
|
||||
rest = [l for l in value.splitlines() if l.strip() and not EMPTY_LINK.match(l)]
|
||||
return bool(rest)
|
||||
|
||||
|
||||
def check(body):
|
||||
"""Return a list of human-readable problems; empty means the body passes."""
|
||||
if not body or not body.strip():
|
||||
return ["The description is empty. Copy .github/PULL_REQUEST_TEMPLATE.md into it and fill it in."]
|
||||
text, found = sections(body)
|
||||
problems = []
|
||||
for name in SECTIONS:
|
||||
if name.lower() not in found:
|
||||
problems.append('Missing section "## %s".' % name)
|
||||
elif not has_content(name, found[name.lower()]):
|
||||
problems.append('Section "## %s" is empty.' % name)
|
||||
if not ISSUE_LINK.search(text) and not NO_ISSUE.search(text):
|
||||
problems.append('No linked issue: add "Closes #<number>", or a line "No linked issue: <reason>".')
|
||||
checklist = found.get("checklist", "")
|
||||
for prefix, label in REQUIRED_TICKS:
|
||||
item = re.search(r"^\s*[-*]\s*\[( |x|X)\]\s*" + re.escape(prefix), checklist, re.M)
|
||||
if not item:
|
||||
problems.append("Checklist is missing %s." % label)
|
||||
elif item.group(1) == " ":
|
||||
problems.append("Tick %s." % label)
|
||||
return problems
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description=__doc__)
|
||||
src = ap.add_mutually_exclusive_group(required=True)
|
||||
src.add_argument("--event", help="GitHub event JSON file (pull_request or pull_request_target)")
|
||||
src.add_argument("--body-file", help="file holding the description text")
|
||||
args = ap.parse_args(argv)
|
||||
if args.event:
|
||||
with open(args.event, encoding="utf-8") as fh:
|
||||
body = (json.load(fh).get("pull_request") or {}).get("body") or ""
|
||||
else:
|
||||
with open(args.body_file, encoding="utf-8") as fh:
|
||||
body = fh.read()
|
||||
problems = check(body)
|
||||
if problems:
|
||||
print("The pull request description does not follow .github/PULL_REQUEST_TEMPLATE.md:")
|
||||
for p in problems:
|
||||
print("- " + p)
|
||||
print("Edit the description to fix this; the check runs again on every edit.")
|
||||
return 1
|
||||
print("The pull request description follows the template.")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,99 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import pr_template_check as c
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
TEMPLATE = open(os.path.join(ROOT, ".github", "PULL_REQUEST_TEMPLATE.md"), encoding="utf-8").read()
|
||||
|
||||
GOOD = """## Summary
|
||||
|
||||
Adds X.
|
||||
|
||||
Closes #12
|
||||
|
||||
## Implementation and evidence
|
||||
|
||||
Touches crates/texture only.
|
||||
|
||||
## Verification
|
||||
|
||||
| Check | Result / evidence |
|
||||
| --- | --- |
|
||||
| Formatting and lint | cargo fmt --check: clean |
|
||||
| Unit / integration tests | cargo test -p xenora-texture: 40 passed |
|
||||
|
||||
## Compatibility and limitations
|
||||
|
||||
None known.
|
||||
|
||||
## Checklist
|
||||
|
||||
- [x] I claimed the linked issue before starting, and the claim was still mine when I opened this pull request.
|
||||
- [x] I reviewed the changes and disclosed material AI assistance below, if applicable.
|
||||
- [x] My commits are signed off under the DCO.
|
||||
|
||||
## AI assistance
|
||||
|
||||
None.
|
||||
"""
|
||||
|
||||
|
||||
class Check(unittest.TestCase):
|
||||
def test_good_body_passes(self):
|
||||
self.assertEqual(c.check(GOOD), [])
|
||||
|
||||
def test_unfilled_template_fails_on_every_rule(self):
|
||||
problems = c.check(TEMPLATE)
|
||||
text = "\n".join(problems)
|
||||
for want in ('"## Summary" is empty', '"## Implementation and evidence" is empty',
|
||||
'"## Verification" is empty', '"## Compatibility and limitations" is empty',
|
||||
'"## AI assistance" is empty', "No linked issue", "claimed-first", "DCO"):
|
||||
self.assertIn(want, text)
|
||||
|
||||
def test_empty_and_freeform_bodies_fail(self):
|
||||
self.assertTrue(c.check(""))
|
||||
self.assertTrue(c.check("Fixes a bug. Closes #3"))
|
||||
|
||||
def test_missing_section_is_named(self):
|
||||
body = GOOD.replace("## Compatibility and limitations\n\nNone known.\n", "")
|
||||
self.assertEqual(c.check(body), ['Missing section "## Compatibility and limitations".'])
|
||||
|
||||
def test_unticked_boxes_fail(self):
|
||||
body = GOOD.replace("- [x] I claimed", "- [ ] I claimed").replace("- [x] My commits", "- [ ] My commits")
|
||||
problems = c.check(body)
|
||||
self.assertEqual(len(problems), 2)
|
||||
self.assertIn("claimed-first", problems[0])
|
||||
self.assertIn("DCO", problems[1])
|
||||
|
||||
def test_issue_link_forms(self):
|
||||
for link in ("Fixes #4", "resolves #4", "Closed #4", "No linked issue: requested by the maintainer"):
|
||||
self.assertEqual(c.check(GOOD.replace("Closes #12", link)), [], link)
|
||||
self.assertIn("No linked issue", "\n".join(c.check(GOOD.replace("Closes #12", "See issue 12"))))
|
||||
|
||||
def test_link_inside_comment_does_not_count(self):
|
||||
self.assertTrue(c.check(GOOD.replace("Closes #12", "<!-- Closes #12 -->")))
|
||||
|
||||
def test_new_claim_checkbox_wording_passes(self):
|
||||
body = GOOD.replace("I claimed the linked issue before starting, and the claim was still mine when I opened this pull request.",
|
||||
"I claimed the linked issue with a reply before starting, and nobody else held a live claim on it.")
|
||||
self.assertEqual(c.check(body), [])
|
||||
|
||||
def test_cli_exit_codes_from_event_file(self):
|
||||
script = os.path.join(ROOT, "scripts", "pr_template_check.py")
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
for body, want in ((GOOD, 0), (TEMPLATE, 1), (None, 1)):
|
||||
path = os.path.join(d, "event.json")
|
||||
with open(path, "w", encoding="utf-8") as fh:
|
||||
json.dump({"pull_request": {"body": body}}, fh)
|
||||
run = subprocess.run([sys.executable, script, "--event", path], capture_output=True, text=True)
|
||||
self.assertEqual(run.returncode, want, run.stdout)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user