Skip to content

fix(ci): skip PR comment steps for fork PRs#499

Merged
superdav42 merged 1 commit intomainfrom
fix/ci-fork-pr-comment-permissions
Mar 26, 2026
Merged

fix(ci): skip PR comment steps for fork PRs#499
superdav42 merged 1 commit intomainfrom
fix/ci-fork-pr-comment-permissions

Conversation

@superdav42
Copy link
Collaborator

Summary

Fixes the 'Build Plugin for Testing' and 'WP Performance Metrics' CI failures that affect all external contributor (fork) PRs, including #491.

Root Cause

GitHub restricts GITHUB_TOKEN write permissions for fork PRs — the token cannot write to the base repo's issues/PRs. Both failing jobs attempted to post PR comments using this token, resulting in HTTP 403 Resource not accessible by integration.

This is a standard GitHub security restriction: fork PRs run with a read-only token to prevent untrusted code from writing to the base repo.

Fix

Added github.event.pull_request.head.repo.full_name == github.repository condition to all PR comment steps in both workflows. This skips the comment steps for fork PRs while keeping them active for PRs from the same repo.

  • pr-build-test.yml: Comment on PR step now skipped for forks
  • tests.yml: Both "Check if a comment was already made" and "Comment on PR with performance results" steps now skipped for forks

Build artifacts and performance results are still uploaded as GitHub Actions artifacts and shown in the workflow summary — they're just not posted as PR comments for fork PRs.

Impact

  • Fork PRs: CI passes (comment steps skipped gracefully)
  • Same-repo PRs: No change in behaviour (comment steps still run)

Unblocks PR #491 and all future external contributor PRs.

Fork PRs run with a restricted GITHUB_TOKEN that cannot write to the
base repo's issues/PRs (GitHub security restriction). Both 'Build Plugin
for Testing' and 'WP Performance Metrics' jobs were failing at the
comment-on-PR step with HTTP 403 'Resource not accessible by integration'.

Add `github.event.pull_request.head.repo.full_name == github.repository`
guard to all PR comment steps so they are skipped for fork PRs. Build
artifacts and performance results are still uploaded and accessible via
the Actions run URL and workflow summary.

Fixes CI failures on external contributor PRs (e.g. PR #491).
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 26, 2026

Warning

Rate limit exceeded

@superdav42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d7d6e027-125f-4994-9fa7-e5c22b0b9f46

📥 Commits

Reviewing files that changed from the base of the PR and between d5d12bf and c88d92f.

📒 Files selected for processing (2)
  • .github/workflows/pr-build-test.yml
  • .github/workflows/tests.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-fork-pr-comment-permissions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

Performance Test Results

Performance test results for 8b3f8c6 are in 🛎️!

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 57 36.38 MB 291.50 ms 101.00 ms 392.50 ms 481.70 ms 406.15 ms 75.20 ms
1 57 36.38 MB 291.00 ms 100.00 ms 391.00 ms 478.00 ms 404.35 ms 75.35 ms

@github-actions
Copy link

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit 246fba6 into main Mar 26, 2026
11 checks passed
superdav42 added a commit to vuckro/multisite-ultimate that referenced this pull request Mar 26, 2026
All CI checks passing. Fixes fork PR comment permission failures.
superdav42 added a commit that referenced this pull request Mar 26, 2026
…+ fix admin fatal error + CI for fork PRs (#491)

* fix(api): serialize Note and Limitations objects, add description to Site REST response

The Note and Limitations classes were not implementing JsonSerializable,
causing json_encode() to produce empty arrays instead of their actual
data in REST API responses. Additionally, Site::to_array() was not
calling get_description() which lazy-loads from wp_options.

Changes:
- Note: implement JsonSerializable, calling existing to_array()
- Limitations: implement JsonSerializable, calling existing to_array()
  (complements the existing __serialize() used by PHP serialize())
- Site::to_array(): add description via get_description()

Closes #490

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(api): load notes and limitations in Site::to_array()

JsonSerializable alone is not sufficient — the properties must also
be loaded before parent::to_array() serializes them. Add explicit
calls to get_notes() and get_limitations() in Site::to_array().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(admin): change add_fields_widget visibility from protected to public

Site_Exporter::register_site_edit_widgets() calls $page->add_fields_widget()
externally via the wu_edit_site_page_register_widgets hook, but the method
was protected, causing a fatal error when the Site Exporter module is active.

This also enables third-party extensions to add custom widgets to edit pages
through the same hook pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(api): add to_array() override to Membership model for meta-stored fields

Membership has two lazy-loaded properties (cancellation_reason, discount_code)
that are fetched from the meta table only when their getter is called.
Without this override, these fields return null in REST API responses.

Follows the same pattern used by Site, Product, Customer, Payment, Email,
Broadcast, and Checkout_Form models.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): write placeholder when secrets are unavailable in fork PRs

GitHub does not share repository secrets with workflows triggered by
pull requests from forks. This caused encrypt-secrets.php to exit(1)
and fail the build for all external contributions.

Write a placeholder inc/stuff.php with empty values instead of
crashing, so the CI pipeline completes. The plugin will function
normally — just without addon API credentials in the test artifact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(api): load billing_address and notes in Customer::to_array(), add JsonSerializable to Billing_Address

Customer::to_array() was missing calls to get_billing_address() and
get_notes(), causing both fields to return null in REST API responses
even when data exists in the database.

Billing_Address, like Note, has protected $attributes and a to_array()
method but was not implementing JsonSerializable, so json_encode()
could not access its data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): preserve existing inc/stuff.php, use stderr for warning

Address CodeRabbit review: don't overwrite inc/stuff.php if it already
exists with valid encrypted credentials. Only write the placeholder
when the file is missing entirely. Use stderr for the warning message
to keep stdout clean for build output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): skip PR comment steps for fork PRs (#499)

All CI checks passing. Fixes fork PR comment permission failures.

---------

Co-authored-by: Valentin Vuckovic <vucko@MacBookPro.lan>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: David Stone <david@nnucomputerwhiz.com>
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.

1 participant