Skip to content

Phase 3 #3

Description

@mirabelledoiron

GitHub Action

Steps

  1. Scaffold the action — Create apps/github-action/ in the monorepo. Use TypeScript with @actions/core and @actions/github packages. Define action.yml with inputs (token file path, thresholds, fail-on-error).

  2. Define the config format.colorxrc.json at repo root specifying color pairs and minimum thresholds:

    {
      "pairs": [
        { "fg": "--color-text", "bg": "--color-background", "wcag": "aa", "apca": 60 }
      ],
      "tokenFile": "tokens.json"
    }
  3. Build the token parser — Read CSS files (extract custom properties), JSON token files (Style Dictionary format), or raw key-value pairs. Map them to hex values.

  4. Run the audit — Import checkContrast and checkAPCA from @colorx/core. Validate every configured pair against its threshold.

  5. Generate the report — Markdown table with pair name, WCAG ratio, APCA Lc, pass/fail badge. Include a summary line (e.g. "11/11 pairs passing" or "2 failures found").

  6. Post as PR comment — Use @actions/github to post the report as a comment on the pull request via github.rest.issues.createComment(). Update existing comment on re-runs instead of creating duplicates.

  7. Set check status — Fail the CI check (core.setFailed()) if any pair drops below its configured minimum. Pass with a success summary otherwise.

  8. Add CVD warnings — Optional: flag pairs where the simulated CVD contrast drops below thresholds even if the original passes.

  9. Test locally — Use act (local GitHub Actions runner) to test with sample repos containing token files.

  10. Write action README — Usage examples, input/output docs, badge markdown.

  11. Publish to GitHub Marketplace — Tag a release, submit via the Actions marketplace flow.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions