Skip to content

feat(pasteCI): add hook pasting failing CI output to the pull request - #45

Open
Osheun wants to merge 1 commit into
calebephrem:mainfrom
Osheun:feat/pasteci-hook
Open

feat(pasteCI): add hook pasting failing CI output to the pull request#45
Osheun wants to merge 1 commit into
calebephrem:mainfrom
Osheun:feat/pasteci-hook

Conversation

@Osheun

@Osheun Osheun commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What

New pasteCI hook, as requested in #3. On workflow_run.completed with a failure conclusion, it:

  1. lists the run's jobs and keeps the failed ones
  2. downloads each failed job's log, strips the timestamps, and keeps the last lines lines (capped at ~6k chars per job to stay far below GitHub's 65k comment limit)
  3. pastes them into a comment on every PR attached to the run — one collapsible <details> block per failed job, with a direct link to the job

The comment is a single updatable comment (hidden <!-- hookto-paste-ci --> mark): later runs update it in place, and when CI passes again it is refreshed to say so instead of leaving stale failure output. If logs are expired/inaccessible, the failed job is still listed. Runs without an attached PR (e.g. forked PRs, where GitHub sends an empty pull_requests array) are skipped.

Config

Default exactly as specified in the issue, plus an optional lines knob:

hooks:
  pasteCI:
    enabled: false
    lines: 50 # trailing log lines pasted per failed job

Changes

  • src/app/hooks/pasteCI/index.ts + schema.ts
  • schema registered in src/schemas/hooks.ts
  • documented in HOOKS.md (including the fork limitation)
  • app.yml: subscribes to workflow_run and adds actions: read (required to read job logs) — existing deployments need to add these on their GitHub App settings page for the hook to work
  • tests in tests/app/hooks/pasteCI.test.ts (9 tests: paste, line/timestamp trimming, comment update, success refresh, silent success, missing logs, no PR, disabled)

Closes #3

@hookto

hookto Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for opening this PR!

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@Osheun is attempting to deploy a commit to the Caleb's Projects Team on Vercel.

A member of the Team first needs to authorize it.

@hookto

hookto Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Note

All commit messages follow Conventional Commits standard.

@Osheun
Osheun force-pushed the feat/pasteci-hook branch from 5e90920 to dc80e61 Compare August 19, 2026 06:01
@hookto

hookto Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Note

All commits and the PR title adhere to the Conventional Commits specification. Good to go!

On workflow_run.completed with a failure conclusion, downloads the
logs of each failed job and pastes their tail into a single updatable
PR comment. When CI passes again the same comment is refreshed. Adds
the workflow_run event and actions: read permission to app.yml.

Closes calebephrem#3
@Osheun
Osheun force-pushed the feat/pasteci-hook branch from dc80e61 to cc22a6a Compare August 20, 2026 20:47
@calebephrem

Copy link
Copy Markdown
Owner

just discovered this approach breaks on forked prs due to empty payload and log stream redirects, so it's probably not worth adding rn

@calebephrem calebephrem added the invalid This doesn't seem right label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New hook: pasteCI

2 participants