Skip to content

refactor: Phase 4.3 — unify project field sync workflows into project-field-sync.yml - #2507

Merged
ashleyshaw merged 9 commits into
developfrom
copilot/phase-4-3-unify-workflows
Sep 3, 2026
Merged

refactor: Phase 4.3 — unify project field sync workflows into project-field-sync.yml#2507
ashleyshaw merged 9 commits into
developfrom
copilot/phase-4-3-unify-workflows

Conversation

Copilot AI commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

issue-fields-backfill.yml (bulk, GitHub App auth) and issue-project-field-sync.yml (targeted, PAT auth) shared identical GraphQL logic with inconsistent auth. This consolidates them into a single workflow with consistent GitHub App token auth throughout. Net: −1 workflow.

Linked issues

Relates to #1227 (Workflows Consolidation Initiative)

Summary

.github/workflows/project-field-sync.yml (new, replaces both deleted workflows):

  • bulk mode — processes all open issues; equivalent to former issue-fields-backfill.yml
  • targeted mode — filters by label name or comma-separated issue numbers via issue_filter input
  • Weekly schedule retained (Monday 09:00 UTC) from issue-project-field-sync.yml
  • dry_run input across both modes
  • Warns via core.warning when targeted is selected with an empty issue_filter (would otherwise silently fall back to bulk)

scripts/agents/includes/sync-issue-fields.cjs:

  • run() now dispatches on MODE env var (event | bulk)
  • runEvent() — extracted single-issue event-driven path (existing behaviour, unchanged)
  • runBulk() — new; paginates all open issues and applies native type sync
  • Both exported as named exports

Deleted: issue-fields-backfill.yml, issue-project-field-sync.yml

Safety Nets

  • Existing tests covering behaviour: no unit tests existed for sync-issue-fields.cjs
  • New/refined tests added: none (no test infrastructure for this module)
  • Static analysis/lint rules touched: YAML validated; CJS syntax checked

Approach

  • Structural changes: run() split into runEvent / runBulk; workflow script: block extended with mode-dispatch logic
  • Dead code removed? Yes — duplicate GraphQL operations across two workflow files

Metrics / Benchmarks (if applicable)

  • Before: 2 workflows (728 lines total), mixed auth (GitHub App + PAT)
  • After: 1 workflow, GitHub App token throughout

Verification

  • Unit tests pass locally
  • Key flows smoke-tested: YAML syntax validated; CJS node --check passes
  • No user-visible diffs observed

Risk & Rollback

  • Risk level: Low — logic is a faithful merge; both source workflows remain in git history
  • Rollback plan: revert commit restores both deleted files and the original CJS module

Changelog

Changed

  • scripts/agents/includes/sync-issue-fields.cjs — added MODE parameter (event | bulk); exposes runEvent and runBulk named exports

Removed

  • issue-fields-backfill.yml and issue-project-field-sync.yml replaced by unified project-field-sync.yml with bulk/targeted modes, GitHub App token auth throughout, and dry_run support

Checklist (Global DoD / PR)

  • All AC met and demonstrated
  • Tests added/updated (unit/E2E as appropriate)
  • Accessibility checklist completed (where relevant):
    • Semantic HTML and heading order verified
    • Keyboard navigation and visible focus states verified
    • ARIA used only where needed
    • Contrast and non-colour cues reviewed (WCAG 2.2 AA)
  • Docs/readme/changelog updated (if user-facing)
  • Security checklist completed (where relevant):
    • Untrusted input validated and sanitised
    • Output escaped for its rendering context
    • Privileged actions enforce nonce and capability checks
    • No secrets/sensitive data introduced; OWASP risks reviewed
  • Code/design reviews approved
  • CI green; linked issues closed; release notes prepared (if shipping)

Copilot AI and others added 2 commits August 29, 2026 15:53
…-field-sync.yml

- Create .github/workflows/project-field-sync.yml with bulk and targeted modes
- Migrate auth to GitHub App token (removes PAT dependency)
- Add dry_run mode for safe pre-production validation
- Delete issue-fields-backfill.yml and issue-project-field-sync.yml
- Update sync-issue-fields.cjs with MODE parameter (event/bulk), runEvent and runBulk exports
- Add CHANGELOG entry for removed workflows

Closes #1408

Co-authored-by: ashleyshaw <1805352+ashleyshaw@users.noreply.github.com>
…-mode warning

- Restore weekly schedule trigger (Monday 09:00 UTC) carried over from issue-project-field-sync.yml
- Add core.warning when targeted mode is selected with empty issue_filter to surface unintended bulk fallback

Co-authored-by: ashleyshaw <1805352+ashleyshaw@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor project workflows into project-field-sync.yml refactor: Phase 4.3 — unify project field sync workflows into project-field-sync.yml Aug 29, 2026
Copilot AI requested a review from ashleyshaw August 29, 2026 15:58
@ashleyshaw
ashleyshaw requested a lite review from Copilot August 29, 2026 16:18

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.

🔵 Needs a closer look

The new targeted filter parsing can misclassify labels as issue numbers (breaking targeted runs), and the workflow’s app-token permission set should be aligned with its org-level GraphQL usage to avoid reliability issues.

Pull request overview

This PR consolidates two overlapping project/issue field sync workflows into a single .github/workflows/project-field-sync.yml, standardising on GitHub App authentication and adding a bulk/targeted dispatch interface to reduce duplication and ongoing maintenance.

Changes:

  • Replaced the previous field-sync workflows with one unified workflow supporting bulk and targeted modes plus scheduled weekly runs.
  • Extended scripts/agents/includes/sync-issue-fields.cjs to dispatch by MODE (event/bulk), with extracted runEvent() and new runBulk().
  • Added a changelog entry documenting the consolidation and auth standardisation.
File summaries
File Description
.github/workflows/project-field-sync.yml New unified workflow covering bulk + targeted sync flows with GitHub App token auth and weekly schedule.
scripts/agents/includes/sync-issue-fields.cjs Adds MODE dispatch and bulk processing, exposing runEvent/runBulk.
CHANGELOG.md Documents the Phase 4.3 consolidation and behavioural changes.
.github/workflows/issue-project-field-sync.yml Deleted in favour of the unified workflow.
Review details

Suppressed comments (3)

.github/workflows/project-field-sync.yml:110

  • The workflow token is restricted to just issues + organisation-projects permissions, but this job also queries organisation-level issue types via GraphQL. If other permissions are dropped when you explicitly set permission-* inputs, the org issue type query will consistently fail and force the less reliable repository fallback. Request the members permission explicitly to match the stated prerequisites and improve reliability.
    .github/workflows/project-field-sync.yml:190
  • The targeted-mode filter treats any value that contains a leading number as an issue-number list. Labels that begin with digits (e.g. "2026-roadmap") would be misinterpreted and the workflow would try (and fail) to fetch issue #2026 instead of filtering by label.
    scripts/agents/includes/sync-issue-fields.cjs:26
  • The header comment says the script always writes native_type_* outputs, but in bulk mode it returns an {applied, skipped, errors} object and never writes GITHUB_OUTPUT. Either document that outputs are event-mode only, or emit empty outputs in bulk mode for consistency.
 * Outputs (GITHUB_OUTPUT):
 *   native_type_set     - Name of the native type that was applied, or ""
 *   native_type_id      - ID of the type that was applied, or ""
 */
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ashleyshaw
ashleyshaw marked this pull request as ready for review August 29, 2026 16:32
@ashleyshaw
ashleyshaw enabled auto-merge (squash) August 29, 2026 16:55
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2507

CI Status:pending
Files changed: 4

Recommendations

  • CI checks not green

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2507

CI Status:pending
Files changed: 4

Recommendations

  • CI checks not green

@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🚫 This PR description is missing required template content.

Missing required section(s): Global DoD checklist

Please update the PR body using one of the repository PR templates:

Empty placeholders, unchecked checklist boxes, and stub issue references do not count.

@ashleyshaw ashleyshaw added this to the v1.1 milestone Aug 30, 2026
Signed-off-by: Ash Shaw <ashley@lightspeedwp.agency>
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Branch Naming Issue

This PR's branch name copilot/phase-4-3-unify-workflows doesn't follow the standard pattern.

Standard pattern: {type}/{scope}-{title} (e.g., feat/something, fix/bug-name)

Based on linked issue type: refactor

Correct template should be: pr_refactor.md

No action required — this is informational. Future PRs should use the correct branch name.

See Branching Strategy for more info.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2507

CI Status:pending
Files changed: 4

Recommendations

  • CI checks not green

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

❌ Branch Name Validation Failed

The branch name copilot/phase-4-3-unify-workflows does not follow the LightSpeed branching strategy.

Required Format

{type}/{scope}-{short-title}
  • type: one of the allowed prefixes (lowercase)
  • scope: lowercase, hyphens only (no underscores or uppercase)
  • title: lowercase, hyphens only (no underscores or uppercase)

Allowed Branch Types

feat, fix, hotfix, release, refactor, chore, docs, test, perf, ci, build, deps, security, revert, research, design, a11y, ux, i18n, ops, proto, ds, api, schema, telemetry, content, seo, config, migrate, qa, uat, audit, codex

Valid Examples

  • feat/branch-naming-enforcement
  • fix/validation-script-bug
  • chore/update-dependencies
  • docs/branching-strategy-guide
  • hotfix/critical-security-patch

Invalid Examples

  • claude/my-branch (type "claude" not allowed)
  • Feature/MyBranch (uppercase not allowed)
  • fix-bug (missing type prefix)
  • feat/my_feature (underscores not allowed)
  • feat/MyFeature (uppercase not allowed)

Solution

Rename your branch to follow the pattern and update the PR.

For more information, see docs/BRANCHING_STRATEGY.md.

@claude claude Bot added area:ci Build and CI pipelines area:documentation Docs & guides area:scripts Scripts & tooling lang:md Markdown content/docs lang:yaml YAML config labels Sep 2, 2026
@claude claude Bot added the type:bug Bug or defect label Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2507

CI Status:pending
Files changed: 4

Recommendations

  • CI checks not green

@ashleyshaw

Copy link
Copy Markdown
Member

@Mergifyio queue

@mergify

mergify Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • 🟠 Waiting for queue conditions
  • ⏳ Enter queue
  • ⏳ Run checks
  • ⏳ Merge
Waiting for
  • -closed [📌 queue requirement]
  • any of: [🔀 queue conditions]
    • check-neutral = validate-pr-template
    • check-skipped = validate-pr-template
    • check-success = validate-pr-template
All conditions
  • -closed [📌 queue requirement]
  • any of [🔀 queue conditions]:
    • all of [📌 queue conditions of queue rule dependabot-develop]:
      • any of [🛡 GitHub branch protection]:
        • check-neutral = validate-pr-template
        • check-skipped = validate-pr-template
        • check-success = validate-pr-template
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of [📌 queue -> configuration change requirements]:
    • -mergify-configuration-changed
    • check-success = @mergify/Configuration changed
    • check-success = @mergify/Configuration has been deleted
  • any of [📌 queue requirement]:
    • check-neutral = @mergify/Mergify Merge Protections
    • check-skipped = @mergify/Mergify Merge Protections
    • check-success = @mergify/Mergify Merge Protections

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2507

CI Status:pending
Files changed: 4

Recommendations

  • CI checks not green

@ashleyshaw ashleyshaw added type:refactor Refactor or internal change and removed type:bug Bug or defect labels Sep 3, 2026 — with Claude
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2507

CI Status:pending
Files changed: 4

Recommendations

  • CI checks not green

@ashleyshaw
ashleyshaw merged commit ed3bd14 into develop Sep 3, 2026
39 of 51 checks passed
@ashleyshaw
ashleyshaw deleted the copilot/phase-4-3-unify-workflows branch September 3, 2026 20:34
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

✅ PR checklists finalised after merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci Build and CI pipelines area:documentation Docs & guides area:scripts Scripts & tooling lang:md Markdown content/docs lang:yaml YAML config type:refactor Refactor or internal change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 4.3: Unify project field sync workflows into project-field-sync.yml

4 participants