Automated summary
This skill documents how to wire a workflow's Playwright (or other captured-log) failures into the `.github/actions/post-failure-comment` composite action, which scrubs the log with gitleaks and posts or updates a marker-tagged PR comment.
Strengths
- Gives full caller snippets for single-job, multi-job and non-`pull_request` workflows, with the correct gating (`failure()`/`success()` versus `needs.<job>.result`).
- States the motivation precisely: workflow logs are unreadable to the agent (no `gh` CLI, 403 on the logs API), while PR comments arrive as readable webhook events and via the GitHub MCP server.
- Describes a self-contained action that resolves its extractor and scrubber through `${{ github.action_path }}`, so it works without a `scripts/` directory at the consuming repo's root.
- Covers marker-based deduplication and a `resolve` mode that closes out the comment once the run goes green again.
Limitations
- Tightly coupled to one repository's conventions: it assumes the composite action and a unique per-workflow marker already exist.
- Does not explain how to build the action itself, nor the exact expected format of the input log file.
- The supplied text is cut off in the section on additional call gating, so some filtering cases are only partially described.
Use it when adding a new long-running or Playwright workflow whose failures should surface directly in the PR conversation, or when refactoring inline gitleaks-scrub-and-comment blocks into the shared action.
Skip it if the repository does not already ship the `post-failure-comment` composite action, or if failures can be diagnosed from raw logs without posting a PR comment.
Security analysis
SafeThe skill is purely instructional documentation for configuring a GitHub Actions composite action that scrubs logs with gitleaks and posts comments to a PR. It contains no executable shell commands, no destructive actions, no exfiltration, and explicitly emphasizes secret scrubbing. The YAML snippets are standard workflow configuration.
No concerns found
How this analysis is madeExamples
I just added a new Playwright workflow that runs on PRs. Make its failures self-report into the PR conversation using our post-failure-comment composite action, including resolving the comment when the run goes green.Our e2e matrix runs in one job and the comment step lives in the finalize job, but it never posts on failures. Can you switch the conditions to gate on needs.e2e.result instead of failure()/success() and use the e2e-failure-summary marker?There are several workflows with copy-pasted gitleaks scrub and gh pr comment blocks. Refactor them to call ./.github/actions/post-failure-comment in both post and resolve modes.name: post-failure-comment
description: Wire a workflow's Playwright (or other captured-log) failures into the PR conversation as a marker-tagged, secret-scrubbed comment via the .github/actions/post-failure-comment composite action. Use when adding a new long-running/Playwright workflow, when a workflow's failures are opaque to agents iterating on a PR, when the user asks to "make CI failures self-report", or when refactoring inline gitleaks-scrub-and-comment blocks into the shared action.
Failure-comment composite action
Why this exists
Workflow logs in this repo are not directly readable by the Claude agent (no gh CLI, no logs surface in the GitHub MCP server, actions/runs/.../logs returns 403 unauthenticated). When a long-running workflow fails on a PR, the agent has to either ask the user to paste the log or open the run in a browser.
The composite action at .github/actions/post-failure-comment/action.yml solves this: it scrubs the captured log via gitleaks and posts (or updates, via marker-based dedup) a PR comment with the failure block. PR comments arrive as <github-webhook-activity> events the agent can read directly, and are also fetchable via mcp__github__pull_request_read.
The action is self-contained: its extractor and scrubber scripts are co-located in the action's own directory and resolved via $ACTION_PATH (${{ github.action_path }}), so the action travels with whatever repo checks the platform out — there is no dependence on a scripts/ dir at the consuming site's root.
Built once; every Playwright-running workflow should call it.
Caller convention
The action is mode-driven with caller-side gating. Two call sites per workflow: one for the failure post, one for the green-run resolve. The action itself just does what its mode input tells it to — it does not try to detect job state.
Single-job workflow (most common)
The comment step lives in the SAME job as the Playwright run.
- name: Post failure summary
if: ${{ failure() && github.event_name == 'pull_request' }}
uses: ./.github/actions/post-failure-comment
with:
mode: post
log-file: /tmp/<your-log>.log
marker: <unique-marker-slug> # NO `<!-- -->` — the action wraps it
title: <short label> # shown in the comment heading
- name: Resolve failure summary on success
if: ${{ success() && github.event_name == 'pull_request' }}
uses: ./.github/actions/post-failure-comment
with:
mode: resolve
marker: <unique-marker-slug>
title: <short label>
Multi-job workflow
The comment step lives in a DOWNSTREAM job (e.g. finalize after an e2e matrix). failure() / success() reflect the FINALIZE job's state — not the matrix's — so gate on needs.<job>.result instead:
- if: ${{ needs.e2e.result == 'failure' && github.event_name == 'pull_request' }}
uses: ./.github/actions/post-failure-comment
with: { mode: post, log-file: /tmp/playwright-output.log, marker: e2e-failure-summary, title: E2E tests }
- if: ${{ needs.e2e.result == 'success' && github.event_name == 'pull_request' }}
uses: ./.github/actions/post-failure-comment
with: { mode: resolve, marker: e2e-failure-summary, title: E2E tests }
Non-pull_request triggers
For workflow_dispatch (or any event without a github.event.pull_request context), pass the parent PR explicitly and drop the github.event_name part of the if::
- if: failure()
uses: ./.github/actions/post-failure-comment
with:
mode: post
log-file: /tmp/<your-log>.log
marker: <unique-marker-slug>
title: <short label>
pr-number: ${{ inputs.pr_number }}
- if: success()
uses: ./.github/actions/post-failure-comment
with:
mode: resolve
marker: <unique-marker-slug>
title: <short label>
pr-number: ${{ inputs.pr_number }}
Gating the call further
For a workflow whose runtime gate matches the upload-artifact step (e.g. vars.PROD_PLAYGROUND_MODE == 'true'), match the if: on each call to the upload step's gate so the comment behaviour is consistent with the rest of the failure-handling chain. For example:
if: ${{ failure() && vars.PROD_PLAYGROUND_MODE == 'true' }}
if: ${{ success() && vars.PROD_PLAYGROUND_MODE == 'true' }}
Patterns that DON'T work — don't repeat
${{ job.status }}inwith:— silently expands to empty string inside a composite action'swith:block. Two iterations confirmed: no comment ever lands.failure()/success()inside the action's own stepif:— unreliable in composite contexts; whatever GitHub Actions evaluatesfailure()against inside a composite step doesn't reflect the calling job's state in our case.
The caller-side gating in the patterns above is the only approach that has been empirically confirmed to fire (PR #517 finalize job at run 25561744480 — first successful auto-comment after switching to v3 mode-driven design).
Required upstream conditions
-
Capture the log. The Playwright invocation must
2>&1 | tee /tmp/<your-log>.log. The action reads from this path verbatim. If the log is missing or empty, the action emits a "(no log captured)" comment instead of failing. -
Pin a unique marker. The action wraps
<your-marker>as<!-- your-marker -->. Two workflows MUST NOT share a marker — they will clobber each other's comments. Existing markers in use:e2e-failure-summary—e2e-tests.yml→finalize(aggregates the e2e matrix)unit-failure-summary—e2e-tests.yml→unite2e-real-failure-summary—e2e-tests.yml→e2e-realparity-failure-summary—e2e-tests.yml→parityselect-failure-summary—e2e-tests.yml→selecthost-loop-failure-summary—cms-publish-loop-host.ymlprod-mutate-failure-summary—cms-publish-loop-prod.ymlpreview-loop-failure-summary—cms-publish-loop-preview.yml
-
Check out the platform so the action is on disk. The action shells out to its co-located
$ACTION_PATH/extract-playwright-failures.shand$ACTION_PATH/scrub-secrets.js($ACTION_PATH=${{ github.action_path }}). The scripts ship inside the action's own directory, so you do NOT need ascripts/dir at the consuming repo's root — but the action's directory must be present, which means the workflow must check out the repo/path that contains.github/actions/post-failure-comment/(e.g. the reusablee2e-tests.ymlchecks the platform out into.cms-platform/and references the action as./.cms-platform/.github/actions/post-failure-comment). You still wantactions/checkoutfor the site so the captured log path exists, but the extractor + scrubber no longer depend on a site-rootscripts/dir. -
Grant
pull-requests: writeto the workflow. The defaultGITHUB_TOKENworks for posting comments on the same repo, BUT only if the workflow'spermissions:block explicitly grants it. Without this, the embeddedactions/github-scriptcall 403s silently — the workflow log shows the error but no comment is posted, which can fool a casual review. The composite action does NOT requireCMS_E2E_PAT. Minimum block:permissions: contents: read pull-requests: write
What the action does internally
| Step | Gate | Notes |
|---|---|---|
| Install gitleaks | outcome == 'failure' | Installs to $HOME/.local/bin (no sudo). Adds to $GITHUB_PATH so subsequent steps see it. |
| Extract & scrub | outcome == 'failure' | Runs $ACTION_PATH/extract-playwright-failures.sh; falls back to tail -c 80000 if the extractor finds nothing. Scrubs via $ACTION_PATH/scrub-secrets.js (gitleaks). Truncates to 60 KB. |
| Post comment | outcome == 'failure' AND (pull_request event OR pr-number set) | Marker-based update-or-create. |
| Resolve on success | outcome == 'success' AND (pull_request event OR pr-number set) | Replaces an existing failure comment with a "passing on <sha>" stub. |
The action no-ops on cancelled, skipped, or null outcomes — those rarely indicate a real failure that warrants a comment.
Security: env vars, not interpolation
Inputs to the embedded actions/github-script calls are passed via env: and read as process.env.X, not inlined as ${{ inputs.x }} into the script body. This is the pattern the github-script README explicitly requires; inlining input strings into a JS body is a classic script-injection vector. If you extend the action with new fields, follow the same pattern.
Security: gitleaks pass-through is non-optional
Every comment that lands on a PR via this action runs through $ACTION_PATH/scrub-secrets.js (which shells out to gitleaks detect --no-git --source <log>) inside the action's Extract and scrub failure summary step. There is no caller-side switch to disable it.
If you extend the action with new modes or new emit-paths, keep the scrubber call on every code path that emits log content into a comment body. A leaked PAT, AWS key, or token in failure output that bypasses gitleaks would be visible to anyone with read access to the PR (which on a public repo means the open internet, including search-engine indexers). The platform's secrets-scan.yml workflow prevents secrets from reaching git history; the gitleaks pass-through here is the equivalent guard for everything that reaches a PR comment.
Triple-check this when:
- Adding a new
mode:value (e.g.digest,summary, anything that emits log content). - Refactoring the extract / post sequence (don't accidentally hoist the github-script call above the scrubber).
- Adding a new fallback path inside the action's
Extract and scrub failure summarystep.
Common refactor pitfalls
- Missing
pull-requests: writepermission — the most subtle and most common. The defaultGITHUB_TOKENis read-only unless explicitly elevated; without elevation the comment-post 403s silently and the workflow looks like it ran the comment step but produced no comment. ALWAYS addpull-requests: writeto a workflow'spermissions:block when wiring this action in. Verified by listing PR comments after a deliberately-broken push (see "Testing your wiring" below). - The action's directory isn't on disk — happens when slotting the action into a one-step workflow that never checks out the repo/path holding
.github/actions/post-failure-comment/. The extractor + scrubber are co-located in that directory and resolved via$ACTION_PATH, so the action dir itself must be present (auses: ./...path can't resolve otherwise). In the reusable platform model the harness checks the platform out into.cms-platform/and references./.cms-platform/.github/actions/post-failure-comment. A separate siteactions/checkoutis still wanted so the captured log path exists. - Overlapping markers — copy-pasting from another workflow without changing the marker. Always pick a globally-unique slug.
- Wrong outcome source —
${{ job.status }}is the canonical source for single-job workflows. For workflows with multiple dependent jobs (likee2e-tests.yml's post-job), pass${{ needs.<job>.result }}instead — and rememberneeds.<job>.resultonly reflects ONE upstream job. If the workflow has multiple matrix jobs that should all gate the comment, AND-combine them in an intermediate step. - Skipping the gate on
pull_request— for workflows that ALSO fire onscheduleorworkflow_dispatch, the action'sif:will skip posting (no PR context) but the gitleaks install still runs. To save runtime, add&& github.event_name == 'pull_request'to the caller'sif:or usepr-numberfor explicit-target workflows.
When NOT to use this
- Non-Playwright workflows with short logs. The extractor matches Playwright's
--reporter=listblocks; for other tooling it falls back totail -c, which is usually less useful than the workflow's own native error output. If your workflow already prints a clear single-line error, a comment with 60 KB of tail noise is worse than no comment. - Workflows with no PR context AND no parent PR.
schedule-only workflows (e.g.canary-prod.yml) have no PR to comment on. Open an issue instead, which is whatcanary-prod.ymlalready does in itsif: failure()branch. - One-off / hotfix workflows. The marker dedup convention requires a stable name; ad-hoc workflows would pollute the PR with stale "passing" stubs.
Testing your wiring
- Push a deliberately-broken commit (e.g. add
await page.waitForTimeout(99999999)to a spec). - Watch for the workflow to fail.
- Check the PR for a new
<!-- your-marker -->comment — it should arrive ~30s after the workflow ends. - Push a fix that turns the workflow green.
- The comment should refresh to
## <title> passing on <sha>within ~30s of the green run.
Files
All three live together in the action's directory and travel with it (resolved at runtime via $ACTION_PATH = ${{ github.action_path }}):
.github/actions/post-failure-comment/action.yml— the composite action..github/actions/post-failure-comment/extract-playwright-failures.sh— awk-based extractor for Playwright--reporter=listfailure blocks..github/actions/post-failure-comment/scrub-secrets.js— gitleaks-backed scrubber. Replaces detected secrets in-place with<REDACTED:RuleID>.- AGENTS.md "Failure-comment composite action" — short reference; this skill is the long-form.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/post-ci-failure-as-pr-comment-msjwk4q8/download' --output '.skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8/SKILL.md.part' && mv '.skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8/SKILL.md.part' '.skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8/SKILL.md' && test -s '.skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/post-failure-comment' && cp -R '.skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8' '.claude/skills/post-failure-comment'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8'openskills read 'post-ci-failure-as-pr-comment-msjwk4q8'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/post-ci-failure-as-pr-comment-msjwk4q8/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Configure a Chat Channel with SecretRefs
DevOps
Set up chat channels using non-interactive commands, with secrets only as SecretRefs. Covers gather, mutate, repair, and prove steps for reliable delivery.
Investigate ClickHouse CI Failures
DevOps
Investigate a ClickHouse CI failure end-to-end from a PR or S3 report URL. Fetches failed tests, classifies flaky vs real regression, and checks for existing issues/fixes.
Ansible PR Review
DevOps
Reviews an Ansible PR following the project's standardized process, including changelog checks, test coverage validation, and feedback tracking.