Skip to content

feat: sync linked issue labels to pull requests#1876

Closed
cheese-cakee wants to merge 2 commits intohiero-ledger:mainfrom
cheese-cakee:feat/sync-issue-labels-clean-v2
Closed

feat: sync linked issue labels to pull requests#1876
cheese-cakee wants to merge 2 commits intohiero-ledger:mainfrom
cheese-cakee:feat/sync-issue-labels-clean-v2

Conversation

@cheese-cakee
Copy link
Contributor

Description

Adds an automated GitHub workflow + bot script to sync labels from linked issues to pull requests.

When a PR body includes closing keywords (for example Fixes #123), the workflow fetches labels from those linked issues and adds missing labels to the PR.

Related issue(s)

Fixes #1716

What changed

  • Added compute workflow: .github/workflows/sync-issue-labels-compute.yml
    • Uses pull_request_target on opened, edited, reopened, synchronize, and ready_for_review
    • Includes secure defaults (harden-runner, checkout main, pinned action SHAs)
    • Supports workflow_dispatch with pr_number + dry_run
    • Computes labels from linked issues and uploads as artifact
  • Added add workflow: .github/workflows/sync-issue-labels-add.yml
    • Triggered by workflow_run (not pull_request_target)
    • Uses actions-ecosystem-add-labels action to add labels
    • Runs with write permissions
  • Added script: .github/scripts/sync-issue-labels.js
    • Skips bot/dependabot PRs
    • Parses linked same-repo issue references from closing keywords (fixes/closes/resolves)
    • Aggregates labels from all linked issues (deduplicated)
    • Adds only missing labels to the PR (idempotent/additive)
    • Returns labels for workflow consumption
  • Added changelog entry under [Unreleased] -> .Github

Scope note

This PR intentionally implements label sync only (additive). It does not remove labels from PRs and does not include assignee sync.

Architecture

Two separate workflows to avoid pull_request_target limitations:

  1. sync-issue-labels-compute.yml - reads labels (runs in pull_request_target context)
  2. sync-issue-labels-add.yml - writes labels (runs in workflow_run context with write permissions)

Testing

Local validation

  • node --check .github/scripts/sync-issue-labels.js

Checklist

  • Documented (workflow + script behavior is self-logged and changelog updated)
  • Tested (syntax check)

Replaces the existing beginner issue template with a structurally
distinct design focused on increasing completion rates.

Key changes:
- Readiness self-check so contributors can assess if they are ready
- Single "The Task" section replaces the Description/Solution/Steps split
- "Where to Start" exploration pointers replace step-by-step recipes
- Compact workflow quick-reference table instead of full tutorial
- Common pitfalls section addressing real failure patterns
- External Python documentation references alongside project docs
- All links converted to absolute URLs for correct issue rendering
- AI guidance folded into pitfalls (no standalone section)

Resolves: #1651

Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
- Adds workflow to compute labels from linked issues
- Adds workflow to add labels via actions-ecosystem-add-labels
- Skips bot-authored PRs, handles dry-run mode
- Implements single-responsibility functions for maintainability

Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
@github-actions
Copy link

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

Quick Fix for CHANGELOG.md Conflicts

If your conflict is only in CHANGELOG.md, you can resolve it easily using the GitHub web editor:

  1. Click on the "Resolve conflicts" button in the PR
  2. Accept both changes (keep both changelog entries)
  3. Click "Mark as resolved"
  4. Commit the merge

For all other merge conflicts, please read:

Thank you for contributing!

@cheese-cakee cheese-cakee deleted the feat/sync-issue-labels-clean-v2 branch February 26, 2026 18:58
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61a6f38 and 306756b.

📒 Files selected for processing (5)
  • .github/ISSUE_TEMPLATE/03_beginner_issue.yml
  • .github/scripts/sync-issue-labels.js
  • .github/workflows/sync-issue-labels-add.yml
  • .github/workflows/sync-issue-labels-compute.yml
  • CHANGELOG.md

Walkthrough

This PR introduces a workflow system to synchronize pull request labels from linked issues, rewrites the beginner issue template with enhanced guidance for first-time contributors, and updates the changelog. The label syncing feature includes a GitHub Actions script that extracts linked issue numbers, collects labels from those issues, computes missing labels, and applies them to the PR via two coordinated workflows.

Changes

Cohort / File(s) Summary
Issue Label Sync Workflows
.github/scripts/sync-issue-labels.js, .github/workflows/sync-issue-labels-compute.yml, .github/workflows/sync-issue-labels-add.yml
Introduces label synchronization system: a script that parses PR bodies for linked issues, fetches their labels, and computes missing labels with robust error handling and dry-run support; two workflows that orchestrate label computation and application via artifacts and GitHub API.
Beginner Issue Template
.github/ISSUE_TEMPLATE/03_beginner_issue.yml
Comprehensively rewrites template with structured guidance for beginners, including prefilled sections (before_you_start, task, research, implementation, testing), examples for AccountId.__repr__, background research pointers, AI tool tips, resources, and workflow quick reference.
Changelog
CHANGELOG.md
Documents additions including CodeRabbit review instructions, path mappings, workflow improvements, fixes to GitHub bot recommendations and TopicInfo.__str__ UTC formatting, and various documentation and test enhancements.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant GitHub as GitHub<br/>(PR Event)
    participant ComputeWF as Compute Workflow
    participant Script as Label Sync Script
    participant GitHubAPI as GitHub API
    participant AddWF as Add Workflow

    User->>GitHub: Open/Update PR with linked issue
    GitHub->>ComputeWF: Trigger on pr event
    ComputeWF->>Script: Run sync-issue-labels.js
    Script->>GitHubAPI: Fetch PR data
    Script->>GitHubAPI: Fetch linked issue labels
    Script->>Script: Compute missing labels
    ComputeWF->>GitHub: Upload labels.json artifact
    GitHub->>AddWF: Trigger on compute success
    AddWF->>GitHub: Download artifact
    AddWF->>GitHubAPI: Apply labels to PR
    GitHubAPI-->>User: PR now labeled
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

📋 Issue Planner

Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).

View plan for ticket: #1716

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cheese-cakee
Copy link
Contributor Author

cheese-cakee commented Feb 27, 2026

Closed due to merge conflicts

The PR had unresolved merge conflicts with main branch. Closed and replaced by #1877 which resolves conflicts and includes all feedback from #1815.

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.

[Intermediate]: Create a workflow to copy over the issue labels, type to the PR labels

1 participant