Skip to content

Centralize label management and fix permission issues#2018

Merged
aaronpowell merged 5 commits into
stagedfrom
aaronpowell/redesigned-meme
Jun 17, 2026
Merged

Centralize label management and fix permission issues#2018
aaronpowell merged 5 commits into
stagedfrom
aaronpowell/redesigned-meme

Conversation

@aaronpowell

Copy link
Copy Markdown
Contributor

Description

This PR addresses widespread label management issues and consolidates scattered label creation logic into a single, centralized workflow.

Problem: GitHub Actions tokens from non-contributor users (e.g., external plugin submitters) lack permissions to create or modify repository labels, causing workflow failures. Additionally, label creation logic was duplicated across 7 different files (6 workflows + 1 JS module), making maintenance difficult and inconsistent.

Solution:

  • Created .github/workflows/setup-labels.yml as a single source of truth for all 18 repository labels (manual workflow_dispatch trigger)
  • Removed label creation logic from all other workflows and modules
  • All workflows now assume labels exist; if they don't, the workflow fails—signaling maintainers to dispatch setup-labels

Files Changed:

  • New: .github/workflows/setup-labels.yml - Centralized label management workflow
  • Modified: 6 workflows + 1 JS module to remove redundant label creation logic and fix permission issues
  • Removed: ensureLabel() functions and managedLabels constants that are no longer needed

Type of Contribution

  • Update to existing instruction, prompt, agent, plugin, skill, or workflow.

Additional Notes

This is primarily a refactoring of existing label management logic with the following benefits:

  • Eliminates permission errors from non-contributor workflows
  • Single point of maintenance for all label definitions
  • Cleaner separation of concerns: setup-labels creates, other workflows only manage
  • Workflows fail fast if labels are missing, rather than silently creating them with insufficient permissions

By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

aaronpowell and others added 4 commits June 17, 2026 09:32
…val workflow

The sync-merged-pr-labels job needs pull-requests: write permission to
add/remove labels on merged PRs. Previously it only had issues: write which
is for issues, not pull requests. This fixes the permission error when
workflows try to modify PR labels from a non-contributor account.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e labels

When running on PRs from fork contributors, the GitHub token may not have
permission to create labels in the repository. This is expected and should
not cause the workflow to fail. Allow the ensureLabel function to gracefully
handle 403 Forbidden errors in addition to 422 (label already exists) errors.

This fixes the sync-pr-state job failure in external-plugin-pr-quality-gates.yml
when run on PRs from external contributors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… workflow

Create a new 'setup-labels' workflow that is manually dispatched and handles
all label creation and updates. This workflow:
- Creates all labels used by the repository
- Updates descriptions if labels already exist
- Reports success/failure counts
- Fails if any labels cannot be created

All individual workflows now assume labels exist and will fail (loudly) if
they don't. This makes it clear to maintainers when the setup-labels workflow
needs to be dispatched:

- label-pr-intent.yml
- skill-check-comment.yml
- external-plugin-approval-command.yml
- external-plugin-command-router.yml
- external-plugin-rereview.yml
- external-plugin-rereview-command.yml
- eng/external-plugin-intake-state.mjs

This approach is better because:
- Single source of truth for label definitions
- Avoids permission issues with fork contributors
- Clear failure modes when labels are missing
- Easier to maintain consistent label configuration
- No more scattered label creation logic across workflows

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Labels are now centrally managed by the setup-labels workflow and
assumed to exist in all other workflows. Removed:

- ensureLabel() methods from all 6 workflows and 1 JS module
- managedLabels constants that were only used by ensureLabel
- Promise.all() calls that invoked ensureLabel for each label
- Updated syncManagedLabels in skill-check-comment.yml to remove ensureLabel call

All workflows now assume labels exist and will fail if they don't,
which is the desired behavior—it signals maintainers to dispatch the
setup-labels workflow when new labels need to be created.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 17, 2026 00:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions github-actions Bot added new-submission PR adds at least one new contribution workflow PR touches workflow automation labels Jun 17, 2026
…label

Merged changes from staged branch which added the canvas-extension label
and configuration. Kept our simplified label object structure (boolean flags
instead of color/description metadata, which is now centralized in setup-labels.yml).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aaronpowell aaronpowell merged commit fae6a92 into staged Jun 17, 2026
10 of 11 checks passed
@aaronpowell aaronpowell deleted the aaronpowell/redesigned-meme branch June 17, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-submission PR adds at least one new contribution workflow PR touches workflow automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants