Skip to content

chore(bounty): overhaul bounty automation with TypeScript pipeline and CI job#2636

Merged
tusharmath merged 15 commits intomainfrom
bounty-scripts
Mar 23, 2026
Merged

chore(bounty): overhaul bounty automation with TypeScript pipeline and CI job#2636
tusharmath merged 15 commits intomainfrom
bounty-scripts

Conversation

@tusharmath
Copy link
Collaborator

@tusharmath tusharmath commented Mar 23, 2026

Summary

Overhaul the bounty label automation system with a new TypeScript pipeline, Rust-based CI job generation, and consolidated label definitions.

Context

The previous bounty automation was a collection of loosely coupled shell/script files. This PR replaces it with a clean parse/plan/execute pipeline written in TypeScript, adds a Rust forge_ci job to generate the bounty workflow, consolidates label naming to the canonical emoji format, and removes the timeout field from MCP server configs that was added prematurely.

Changes

  • New TypeScript bounty pipeline (sync-issue.ts, sync-pr.ts, rules.ts, types.ts, api.ts) with full test coverage — replaces legacy shell scripts
  • Rust CI job (bounty_job.rs, bounty.rs) added to forge_ci for generating the .github/workflows/bounty.yml file programmatically
  • Label definitions consolidated in .github/labels.json — canonical names now use the emoji format (bounty: 💰 $N); old plain-text names moved to aliases; generic bounty label removed
  • Feature request template updated with Use Cases, Implementation Ideas, and Contribution fields, plus a stricter pre-submission checklist
  • MCP timeout field removed from McpHttpServer and McpStdioServer — related tests and dead code cleaned up
  • .gitignore fixed — removed the broad jobs/ rule that was incorrectly shadowing crates/forge_ci/src/jobs/
  • package.json gains test:bounty, bounty:sync-issue, and bounty:sync-pr npm scripts

Testing

# Run the bounty pipeline tests
npm run test:bounty

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

# Dry-run the sync scripts (requires GH_TOKEN)
npm run bounty:sync-issue
npm run bounty:sync-pr

@github-actions github-actions bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Mar 23, 2026
Comment on lines +36 to +46
propagate-bounty-label:
name: Propagate bounty label to PR
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy bounty label from linked issue to PR
run: npx tsx .github/scripts/bounty/propagate-label.ts --pr ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --token ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Critical: Job will fail on non-pull_request events

This job is missing an if condition to prevent it from running on issues and pull_request_target events. When an issue is assigned/unassigned, this job will execute and ${{ github.event.pull_request.number }} will be null/undefined, causing the script to fail.

Fix:

propagate-bounty-label:
  name: Propagate bounty label to PR
  if: github.event_name == 'pull_request'
  runs-on: ubuntu-latest
Suggested change
propagate-bounty-label:
name: Propagate bounty label to PR
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy bounty label from linked issue to PR
run: npx tsx .github/scripts/bounty/propagate-label.ts --pr ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --token ${{ secrets.GITHUB_TOKEN }}
propagate-bounty-label:
name: Propagate bounty label to PR
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy bounty label from linked issue to PR
run: npx tsx .github/scripts/bounty/propagate-label.ts --pr ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --token ${{ secrets.GITHUB_TOKEN }}

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +64 to +73
const req = https.request(options, (res) => {
let data = "";
res.on("data", (chunk: string) => (data += chunk));
res.on("end", () => {
try {
resolve(data ? (JSON.parse(data) as T) : ({} as T));
} catch {
resolve({} as T);
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Critical: HTTP errors are silently ignored

The request method doesn't check the HTTP status code. API errors (4xx, 5xx) will be treated as successful responses, causing scripts to continue execution with invalid data. This will lead to silent failures in production.

Fix:

const req = https.request(options, (res) => {
  let data = "";
  res.on("data", (chunk: string) => (data += chunk));
  res.on("end", () => {
    if (res.statusCode && res.statusCode >= 400) {
      reject(new Error(`HTTP ${res.statusCode}: ${data}`));
      return;
    }
    try {
      resolve(data ? (JSON.parse(data) as T) : ({} as T));
    } catch (e) {
      reject(e);
    }
  });
});
Suggested change
const req = https.request(options, (res) => {
let data = "";
res.on("data", (chunk: string) => (data += chunk));
res.on("end", () => {
try {
resolve(data ? (JSON.parse(data) as T) : ({} as T));
} catch {
resolve({} as T);
}
});
const req = https.request(options, (res) => {
let data = "";
res.on("data", (chunk: string) => (data += chunk));
res.on("end", () => {
if (res.statusCode && res.statusCode >= 400) {
reject(new Error(`HTTP ${res.statusCode}: ${data}`));
return;
}
try {
resolve(data ? (JSON.parse(data) as T) : ({} as T));
} catch {
reject(new Error("Failed to parse JSON response"));
}
});

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +38 to +47
sync-issue:
name: Sync issue bounty labels
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync bounty labels
run: npx tsx .github/scripts/bounty/v2/sync-issue.ts --issue ${{ github.event.issue.number }} --repo ${{ github.repository }} --token ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

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

The sync-issue job will fail when triggered by pull_request events because github.event.issue.number is undefined for those events. The job needs a conditional to only run on issues events:

if: github.event_name == 'issues'

Without this, the workflow will crash with "cannot read property 'number' of undefined" whenever a PR is opened/edited/reopened.

Suggested change
sync-issue:
name: Sync issue bounty labels
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync bounty labels
run: npx tsx .github/scripts/bounty/v2/sync-issue.ts --issue ${{ github.event.issue.number }} --repo ${{ github.repository }} --token ${{ secrets.GITHUB_TOKEN }}
sync-issue:
name: Sync issue bounty labels
runs-on: ubuntu-latest
if: github.event_name == 'issues'
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync bounty labels
run: npx tsx .github/scripts/bounty/v2/sync-issue.ts --issue ${{ github.event.issue.number }} --repo ${{ github.repository }} --token ${{ secrets.GITHUB_TOKEN }}

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@tusharmath tusharmath enabled auto-merge (squash) March 23, 2026 10:16
@tusharmath tusharmath changed the title feat(bounty): add GitHub actions for bounty label lifecycle chore(bounty): overhaul bounty automation with TypeScript pipeline and CI job Mar 23, 2026
@tusharmath tusharmath merged commit e946aaa into main Mar 23, 2026
8 checks passed
@tusharmath tusharmath deleted the bounty-scripts branch March 23, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant