Skip to content

Conversation

@m2ux
Copy link
Contributor

@m2ux m2ux commented Dec 8, 2025

Workflow Configuration Validation

Adds validation workflow to catch production workflow configuration errors during PR review, preventing issues from reaching main branch.

Problem: The prod.yml workflow only runs after merge to main, so configuration errors are not detected until production deployment fails.

Solution: Created validate-workflow-config.yml that runs on PRs to verify configuration before merge.


Key Benefits

  • Prevents production failures - Catches configuration errors before merge
  • Fast feedback - Validates in < 30 seconds during PR review
  • Actionable errors - Clear messages guide developers to fix issues

What's New

Core Changes:

  • .github/workflows/validate-workflow-config.yml - New validation workflow (91 lines)
    • Validates prod.yml has "Enable Corepack (Pre-Setup)" step
    • Validates all workflows use yarn version from package.json
    • Triggers only on PRs that modify workflow files or package.json

Documentation:

  • docs/architecture/adr0003-workflow-validation.md - ADR documenting decision (171 lines)

Validation Checks

  1. Pre-Setup Corepack Pattern

    ✅ Verifies prod.yml has "Enable Corepack (Pre-Setup)" before "Setup Node.js"
    

    Prevents: actions/setup-node interfering with corepack

  2. Yarn Version Consistency

    ✅ Validates all workflows use yarn version matching package.json
    

    Prevents: Version mismatches causing CI failures


Example Output

Success:

✅ prod.yml has correct pre-setup corepack step
✅ build.yml uses correct yarn version (4.12.0)
✅ pr.yml uses correct yarn version (4.12.0)
✅ All workflow configuration validations passed!

Failure:

❌ ERROR: prod.yml is missing the 'Enable Corepack (Pre-Setup)' step

The production workflow must enable corepack BEFORE the 'Setup Node.js' step
to prevent the actions/setup-node action from interfering with corepack.

Expected pattern in prod.yml:
  - name: Enable Corepack (Pre-Setup)
    run: corepack enable

Testing

  • Local validation tests (3/3 passing)
  • All 4 workflows validated correctly

Files Changed

2 files changed, 262 insertions(+)

New Files:

  • .github/workflows/validate-workflow-config.yml (91 lines)
  • docs/architecture/adr0003-workflow-validation.md (171 lines)

Backward Compatibility

100% backward compatible - This is additive only. No changes to existing workflows or behavior. Simply adds validation that runs on PRs.


Related Work


ADR: docs/architecture/adr0003-workflow-validation.md

m2ux added 3 commits December 8, 2025 11:13
…setup

Update all GitHub Actions workflows to match package.json packageManager specification:

- prod.yml: Add pre-setup corepack enable + update to [email protected]
- build.yml: Update from [email protected] to [email protected]
- pr.yml: Update from [email protected] to [email protected]
- playwright-visual-regression.yml: Update from [email protected] to [email protected]

Key changes:
1. All workflows now use [email protected] (matching package.json)
2. prod.yml now includes 'Enable Corepack (Pre-Setup)' step before
   actions/setup-node to match pr.yml pattern
3. The actions/setup-node action can interfere with corepack, so we
   enable it both before and after node setup

Root cause analysis:
- prod.yml only runs on push to main (not during PR review)
- pr.yml and build.yml run on PRs and had correct config
- This meant the issue wasn't detected until after merge

Fixes CI error: 'This project's package.json defines packageManager:
[email protected]. However the current global version of Yarn is 1.22.22.'
Create validate-workflow-config.yml to validate production workflow
configuration during PR review before merge to main.

Validation checks:
- Verifies prod.yml has 'Enable Corepack (Pre-Setup)' step
- Validates all workflows use yarn version from package.json

This prevents configuration issues from reaching main branch that
would only be detected after production deployment fails.

Triggers on PRs that modify .github/workflows/** or package.json.
Completes in < 30 seconds with clear error messages.

WP: Workflow Configuration Validation (Task 1)
Document decision to add validation workflow that checks production
workflow configuration during PR review.

Decision rationale:
- Prevents prod.yml configuration errors from reaching main
- Fast feedback (< 30 seconds) during PR review
- No external dependencies
- Addresses specific issues from recent incident

WP: Workflow Configuration Validation (Task 3)
@m2ux m2ux requested review from a team as code owners December 8, 2025 11:33
@vercel
Copy link

vercel bot commented Dec 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
midnight-wiki Ready Ready Preview Comment Dec 8, 2025 5:03pm

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

🚀 Preview Deployment

Deployment Ready

🔗 Preview URL: https://pr-446-midnight-docs.vercel.app

📝 Latest commit: 8155dc6
Updated: Dec 8, 2025, 5:03 PM UTC


This preview updates automatically when you push new commits to this PR.

Update validation logic to skip workflows where 'corepack prepare yarn@'
text is found but no version can be extracted. This prevents false
positives from the validation workflow itself, which contains the text
in its validation logic but doesn't actually execute corepack.

Fixes validation failure where validate-workflow-config.yml was
incorrectly flagged as having wrong yarn version.
@m2ux m2ux marked this pull request as ready for review December 8, 2025 17:49
@m2ux m2ux requested a review from gilescope December 8, 2025 17:49
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.

3 participants