Skip to content

chore(bounty): overhaul bounty automation with bulk sync and daily schedule#2663

Merged
tusharmath merged 5 commits intomainfrom
bounty-scripts
Mar 24, 2026
Merged

chore(bounty): overhaul bounty automation with bulk sync and daily schedule#2663
tusharmath merged 5 commits intomainfrom
bounty-scripts

Conversation

@tusharmath
Copy link
Copy Markdown
Collaborator

@tusharmath tusharmath commented Mar 24, 2026

Summary

Overhaul the bounty label automation by replacing the per-issue event-driven sync with a bulk reconciliation pass, adding a daily schedule, and fixing the CI scripts to actually apply changes.

Context

The previous sync-issue CI job would run once per GitHub event (label added, assignee changed) and sync a single issue number. This approach had two problems: the --execute flag was missing so no writes ever happened, and issues that were labeled before the workflow was active (like #2630) were never synced. The new approach fetches all open issues with any bounty label in one API pass, computes the minimal patch for each, and applies them all — closing the gap on missed events and providing a daily catch-all sweep.

Changes

  • New sync-all-issues.ts — fetches all open issues with any bounty label prefix via the GitHub API (paginated), runs the rules engine on each, and applies the combined patch
  • New listIssuesWithLabelPrefix API method — added to GitHubApi interface and GitHubRestApi, with automatic pagination and PR exclusion
  • Replaced sync-issue CI job with sync-all-issues in the Rust workflow generator (forge_ci)
  • Added daily schedule (0 2 * * *) to the bounty workflow so labels stay in sync even without a triggering event
  • Added bounty:sync-all-issues npm script for local dry-runs
  • Fixed --execute flag — both sync-issue and sync-pr now pass --execute in CI so writes are actually applied
  • Full test coverage for the new script (sync-all-issues.test.ts, 6 new tests; 52 total passing)

Testing

# Run all bounty pipeline tests
npm run test:bounty

# Dry-run against the live repo (no writes)
npm run bounty:sync-all-issues -- --repo antinomyhq/forgecode

# Apply changes
npm run bounty:sync-all-issues -- --repo antinomyhq/forgecode --execute

# Run forge_ci Rust tests
cargo insta test --accept -p forge_ci

Instead of triggering sync-issue.ts once per event with a specific
issue number, introduce sync-all-issues.ts which fetches all open
issues carrying any 'bounty' label prefix in a single pass and
reconciles each one.

Changes:
- Add listIssuesWithLabelPrefix() to GitHubApi interface and
  GitHubRestApi (paginates /issues?state=open automatically)
- New sync-all-issues.ts: planAllIssues / syncAllIssues with full
  test coverage (sync-all-issues.test.ts)
- Replace sync_issue_job with sync_all_issues_job in forge_ci;
  update bounty workflow to add a daily schedule (02:00 UTC) in
  addition to the existing issues/label events
- Regenerate .github/workflows/bounty.yml
- Add bounty:sync-all-issues npm script

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@tusharmath tusharmath changed the title bounty scripts chore(bounty): overhaul bounty automation with bulk sync and daily schedule Mar 24, 2026
autofix-ci bot and others added 4 commits March 24, 2026 03:37
…ixtures

Update makeIssue helpers in sync-pr.test.ts and sync-all-issues.test.ts
to include the html_url field (now required on Issue) and add the title
field to makePr (now required on PullRequest), matching the enriched
LabelOp metadata threading added for plan output.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
- Add html_url to Issue and title to PullRequest interface fields
- Add optional title and url fields to LabelOp for display metadata
- Thread title/url through diff() helper via meta parameter
- Enrich all LabelOps in computeIssuePatch and computePrPatch with
  title and html_url from the source issue/PR objects
- Update printPlan to render: '#N — <title>\n    <url>'
  so operators can click directly to the issue or PR

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Replace hand-rolled ANSI escape helpers with chalk (v5, pure ESM).
Colours applied:
- ✔ green  — successful add / already-in-sync
- ✖ red    — removal
- ✉ yellow — comment posted
- cyan     — issue/PR reference (#N)
- green    — added label names
- red      — removed label names
- blue/dim — clickable URL
- dim      — footer hint

chalk automatically disables colours when stdout is not a TTY (e.g.
CI log capture), so no NO_COLOR handling needed.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@tusharmath tusharmath merged commit 1962dae into main Mar 24, 2026
10 checks passed
@tusharmath tusharmath deleted the bounty-scripts branch March 24, 2026 03:46
@tusharmath tusharmath added the type: chore Routine tasks like conversions, reorganization, and maintenance work. label Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: chore Routine tasks like conversions, reorganization, and maintenance work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant