Skip to content

fix: Restore visualizer dependency setup #406

fix: Restore visualizer dependency setup

fix: Restore visualizer dependency setup #406

Workflow file for this run

name: PR automation
on:
pull_request_target:
types: [opened, edited, synchronize, reopened, ready_for_review]
permissions:
pull-requests: read
jobs:
label:
name: Apply path labels
if: contains(fromJson('["opened","synchronize","reopened","ready_for_review"]'), github.event.action)
runs-on: ubuntu-latest
steps:
- name: Label pull request by changed files
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
validate-pr-body:
name: Validate PR summary/testing/docs sections
if: contains(fromJson('["opened","edited","synchronize","reopened"]'), github.event.action)
runs-on: ubuntu-latest
steps:
- name: Enforce PR metadata sections
uses: actions/github-script@v7
with:
script: |
const body = context.payload.pull_request.body || "";
const requiredSections = ["Summary", "Testing", "Docs touched"];
const missingHeaders = requiredSections.filter((section) => {
const headerRegex = new RegExp(`^##\\s+${section}\\s*$`, "im");
return !headerRegex.test(body);
});
const extractSection = (heading) => {
const sectionRegex = new RegExp(
`##\\s+${heading}\\s*[\\r\\n]+([\\s\\S]*?)(?=\\n##\\s+|$)`,
"i"
);
const match = body.match(sectionRegex);
return match ? match[1].trim() : "";
};
const sectionContentIssues = [];
for (const section of requiredSections) {
const content = extractSection(section);
const isDocsSection = section === "Docs touched";
const invalidPlaceholder = !content || content === "-" || (!isDocsSection && content === "None");
if (invalidPlaceholder) {
sectionContentIssues.push(section);
}
}
const errors = [];
if (missingHeaders.length) {
errors.push(`Missing required section headers: ${missingHeaders.join(", ")}.`);
}
if (sectionContentIssues.length) {
errors.push(
`These sections need concrete content (not empty / '-' / 'None' where inappropriate): ${sectionContentIssues.join(", ")}.`
);
}
if (errors.length) {
core.setFailed(
[
"PR metadata requirements failed.",
...errors,
"Please update the PR description to include a short summary, explicit tests, and docs touched/added."
].join("\n")
);
}