Skip to content

ENH: enable curated highlights in weekly report workflow - #305

Merged
mmcky merged 1 commit into
mainfrom
chore/weekly-report-highlights
May 21, 2026
Merged

mmcky merged 1 commit into
mainfrom
chore/weekly-report-highlights

Conversation

@mmcky

@mmcky mmcky commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Picks up the new curated highlights feature shipped in action-weekly-report v2.4.0 (PR QuantEcon/action-weekly-report#6). The weekly report will now produce a themed, noise-suppressed highlights view in addition to the existing tabular report, posted as the first comment on the report issue — matching the style of meta#259 and meta#291 but automated.

Changes

  • Adds highlights: 'true' and llm-summary: 'true' to the action inputs.
  • Wires ANTHROPIC_API_KEY through so the LLM narrative pass can run.
  • Extends the existing github-script step to capture the issue number and post highlights.md as the first comment.
  • Drops the now-removed output-format: 'markdown' input (vaporware in v2.3.0, formally removed in v2.4.0).
  • Adds weekly-report-data.json and highlights.md to the uploaded artifact bundle.

The action is pinned to the floating @v2 tag (unchanged), so v2.4.0 is picked up automatically.

Prerequisite

ANTHROPIC_API_KEY must be added to this repo's secrets before the first run:
Settings → Secrets and variables → Actions → New repository secret

Until then llm-summary still works but the narratives are skipped with a warning — the heuristic-only highlights still post as the comment.

What the highlights look like

Verified end-to-end on the 2026-04-21..05-20 window using v2.4.0:

Section Count
📦 Releases 5
Lectures 8 substantive PRs
Libraries 5 PRs
Tooling 5 PRs
Other 18 PRs (mystmd fork work)
🌐 Translation Sync 18 PRs (collapsed)
Maintenance & Dependencies 27 PRs (collapsed)
Contributors 5 non-bot names

Each themed section gets a one-sentence LLM-drafted narrative (Sonnet 4.6 default). Sample for Libraries: "Extended NormalFormGame and Player to support tuple-based constructors and payoff display, fixed field docstring syntax, and added NumPy random Generator API guidance."

Test plan

  • Add ANTHROPIC_API_KEY repo secret
  • Merge this PR
  • Manually trigger the workflow via workflow_dispatch to verify the first run before the next Saturday cron
  • Confirm the report issue has the highlights comment posted

🤖 Generated with Claude Code

action-weekly-report v2.4.0 ships a new curated highlights view —
PRs grouped by theme (Lectures / Libraries / Tooling / Courses /
Other), bot/dependency noise rolled up, translation-sync PRs in a
collapsed section, optional one-sentence per-theme narratives via
Claude. See QuantEcon/reports-activity#6 for context and
docs/highlights.md in the action repo for the feature reference.

This commit:

- Adds `highlights: 'true'` and `llm-summary: 'true'` action inputs.
  The action picks them up via the floating @v2 tag — no version
  pin change needed.
- Wires ANTHROPIC_API_KEY through as an env var (required for the
  LLM narrative pass; missing key degrades to heuristic-only with a
  warning, never blocks the build).
- Extends the existing github-script step to capture the issue
  number returned by issues.create and post highlights.md as the
  first comment on that issue. Falls back gracefully if highlights.md
  isn't produced.
- Drops the now-removed `output-format: 'markdown'` input (the
  selector was vaporware in v2.3.0 and removed in v2.4.0; existing
  workflows passing it get an unrecognised-input warning).
- Adds report-data.json and highlights.md to the uploaded artifact
  bundle so we can re-run tools/highlights.py offline (e.g. to
  retune themes or compare LLM models) without re-fetching from
  GitHub.

Prerequisite: ANTHROPIC_API_KEY must be added to this repo's secrets
before the first run. Settings → Secrets and variables → Actions →
New repository secret. Until then llm-summary still works but the
narratives are skipped with a warning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 21, 2026 07:40
@mmcky mmcky changed the title chore: enable curated highlights in weekly report workflow ENH: enable curated highlights in weekly report workflow May 21, 2026
@mmcky
mmcky merged commit cad7b61 into main May 21, 2026
4 checks passed
@mmcky
mmcky deleted the chore/weekly-report-highlights branch May 21, 2026 07:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Enables the new “curated highlights” output from QuantEcon/action-weekly-report@v2 in the weekly report workflow, including optional LLM-generated theme narratives, and posts the highlights to the created report issue.

Changes:

  • Enables highlights and llm-summary action inputs and wires through ANTHROPIC_API_KEY.
  • Extends the github-script step to post highlights.md as the first issue comment after creating the report issue.
  • Uploads additional generated files (weekly-report-data.json, highlights.md) in the workflow artifact bundle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +75 to +81
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.data.number,
body: highlights,
});
console.log(`Posted highlights.md (${highlights.length} chars) as first comment`);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — addressed in follow-up #306. Two changes: (1) truncate the body to fit GitHub's 65,536-char limit with a pointer to the artifact, (2) wrap createComment in try/catch so transient API failures log + continue rather than failing the run. The issue itself is created in the line above, so the report is preserved regardless of what happens to the comment step.

mmcky added a commit that referenced this pull request May 21, 2026
)

* chore: harden highlights comment posting against API/size failures

Addresses Copilot's feedback on #305: the createComment call could
fail (oversize body, transient API error, rate limit) and crash the
whole workflow even though the report issue has already been created.

Two hardening changes:

1. Body-size truncation. GitHub caps issue comments at 65,536 chars.
   Today's highlights run at ~10K chars, well below the limit, but a
   busy month with --llm-summary across many translation-sync PRs
   could grow. If highlights.md exceeds the limit, truncate to fit
   and append a footer linking to the workflow run's artifact so the
   full content is recoverable.

2. try/catch around createComment. Transient API failures now log
   to stderr and continue rather than failing the step. Rationale:
   the report issue was already created in the preceding lines, so
   the report is preserved regardless of what happens to the
   comment. highlights.md is also in the uploaded artifact bundle,
   so the highlights themselves are recoverable manually.

Net effect: the workflow now degrades gracefully on any
comment-posting failure mode rather than turning red.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* address Copilot review on PR #306

Two follow-up tweaks both flagged on the inline review:

1. Wrap fs.readFileSync('highlights.md') in its own try/catch.
   existsSync doesn't guarantee the read succeeds (permission/IO
   errors are theoretically possible even on a fresh CI runner), and
   the asymmetry with the weekly-report.md read above was a smell.
   On read failure: log + null out and skip the comment path —
   behaves identically to "file not produced".

2. Log richer fields when createComment fails. Octokit errors carry
   .status and .response.data with the actual diagnostic, while
   .message is often terse ("Validation Failed"). The catch block
   now logs the HTTP status when present, falls back to String(err)
   if .message is missing, and appends response.data when available.
   Future debugging won't be limited to the bare .message.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants