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
7 changes: 4 additions & 3 deletions .github/workflows/reusable-screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ jobs:
git add "$OUT_DIR"
if git diff --cached --quiet; then echo "No screenshot changes"; exit 0; fi
git commit -m "docs: update screenshots"
git push --force-with-lease origin "$BRANCH"
if gh pr view "$BRANCH" >/dev/null 2>&1; then
git push --force origin "$BRANCH" # bot branch is regenerated wholesale each run
if gh pr view "$BRANCH" --state OPEN >/dev/null 2>&1; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a command that supports state filtering

In the screenshot workflow, gh pr view --help only lists --comments, --jq, --json, --template, and --web; passing --state OPEN exits with unknown flag: --state. Consequently this condition always takes the creation path, and the catch-all || echo on gh pr create also turns real authentication, permission, API, or invalid-base failures into a successful workflow with no PR. Use an open-PR query that supports --state (such as gh pr list) and suppress only a confirmed duplicate-PR race.

AGENTS.md reference: AGENTS.md:L30-L30

Useful? React with 👍 / 👎.

echo "PR already open for $BRANCH"
else
gh pr create --base "$DEFAULT_BRANCH" --head "$BRANCH" \
--title "docs: update screenshots" \
--body "Automated screenshots captured from the demo stack. Review each image for real data before merging."
--body "Automated screenshots captured from the demo stack. Review each image for real data before merging." \
|| echo "PR create skipped (already exists from a concurrent run) - success outcome"
fi
5 changes: 3 additions & 2 deletions scripts/screenshots.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const RECORD = process.env.RECORD === "1";

// Edit this list per project: one entry per meaningful screen.
const PAGES = [
{ name: "dashboard", path: "/", waitFor: "#app-ready" },
// "#app-ready" is a hidden marker span; wait for the real rendered title instead.
{ name: "dashboard", path: "/", waitFor: "#page-title", state: "visible" },
{ name: "public", path: "/public" },
];

Expand Down Expand Up @@ -54,7 +55,7 @@ let failed = false;
for (const p of PAGES) {
const page = await context.newPage();
await page.goto(new URL(p.path, BASE).toString(), { waitUntil: "networkidle" });
if (p.waitFor) await page.waitForSelector(p.waitFor, { state: "attached", timeout: 15000 });
if (p.waitFor) await page.waitForSelector(p.waitFor, { state: p.state || "attached", timeout: 15000 });

const text = (await page.evaluate(() => document.body.innerText)) + "\n" + (await page.title());
const hits = FORBIDDEN.filter((f) => f.re.test(text)).map((f) => f.label);
Expand Down
Loading