Skip to content

Decouple Pa11y PR commenting from forked pull_request token permissions#122

Merged
alexwolson merged 6 commits into
mainfrom
copilot/fix-ci-workflow-permissions
May 19, 2026
Merged

Decouple Pa11y PR commenting from forked pull_request token permissions#122
alexwolson merged 6 commits into
mainfrom
copilot/fix-ci-workflow-permissions

Conversation

Copilot AI commented May 17, 2026

Copy link
Copy Markdown
Contributor

Fork-origin PRs were failing in CI because the accessibility job tried to post issue comments using the pull_request token, which is read-only for forks. This change keeps accessibility checks in CI and moves fork comment publishing to a privileged, safe follow-up workflow driven by CI artifacts.

  • Main CI behavior (unchanged intent, explicit boundary)

    • Keeps Pa11y execution and report generation in ci.yml
    • Continues uploading pa11y-report as an artifact
    • Leaves PR comment step gated to non-fork PRs only
  • New fork-safe comment workflow

    • Adds comment-pa11y-report.yml triggered by workflow_run on completed CI
    • Runs only for fork-origin PR runs and only when a PR context exists
    • Uses repository-scoped permissions (issues: write) without checking out PR code
    • Downloads the Pa11y artifact from the CI run and creates/updates the marker-based PR comment (<!-- pa11y-report -->)
  • Hardening and operability

    • Validates PR number before API calls
    • Handles artifact/report absence with explicit warnings (distinguishes download failure vs missing upload)
    • Handles report file read failures explicitly
on:
  workflow_run:
    workflows: ['CI']
    types: [completed]

jobs:
  comment:
    if: >
      github.event.workflow_run.event == 'pull_request' &&
      github.event.workflow_run.head_repository.fork &&
      github.event.workflow_run.pull_requests[0] != null

Copilot AI changed the title [WIP] Fix CI workflow to comment on PRs from forks Decouple Pa11y PR commenting from forked pull_request token permissions May 17, 2026
Copilot AI requested a review from alexwolson May 17, 2026 07:44
@github-actions

Copy link
Copy Markdown
Contributor

Pa11y Accessibility Report

All pages passed — 0 warning(s) (WCAG2AA)


Homepage

✅ No issues found.


Event

✅ No issues found.


Project

✅ No issues found.


Person

✅ No issues found.


Organization

✅ No issues found.


Venue

✅ No issues found.


Resource

✅ No issues found.


Tag

✅ No issues found.


Category

✅ No issues found.

@alexwolson
alexwolson marked this pull request as ready for review May 17, 2026 15:30
@alexwolson
alexwolson merged commit cdf05b8 into main May 19, 2026
2 checks passed
@alexwolson
alexwolson deleted the copilot/fix-ci-workflow-permissions branch May 19, 2026 12:31
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.

CI workflow fails to comment on PRs from forks due to insufficient permissions

3 participants