Repository navigation
Conversation
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
…ting Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
test: cover what the plugin keeps after the webhook removal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The plugin and the
libresigntheme both registerPOST libresign/v1/site-deploy-webhook. WordPress dispatches to the first handler registered, which is the plugin's, so the theme's handler never ran: the secret set for the theme was ignored, and the plugin stored the fetched header and footer in options (libresign_site_fragment_*) that nothing renders, while the fragments the theme actually renders stopped being updated. The plugin also kept a copy of the fetched HTML, unfiltered, behind a public helper with no caller.What changed
The theme becomes the only owner of the route and of the fragment sync. This removes from the plugin:
includes/github-site-webhook.php) and the fragment sync (includes/site-fragment-sync.php);src/Github/SiteDeploy.php,WebhookDecision.php,WebhookGate.php,WebhookRequest.php,WebhookSignature.phpandWorkflowRun.php, with their tests;The deploy dispatch on publish, the deploy token and
Secretstay: the theme reads the encryptedlibresign_github_deploy_tokento comment on the deployed pull request.Before merging
LIBRESIGN_GITHUB_WEBHOOK_SECRETenvironment variable of the WordPress container, which the theme reads first after #21. The value stored in this plugin'slibresign_github_webhook_secretoption is no longer read.includes/github-site-webhook.php, which this PR deletes; whichever is merged second needs the trivial conflict resolved in favour of the deletion.Verification
composer cigreen locally on PHP 8.3: lint, PHPCS, PHPStan and the remaining 145 tests; the structure test still pairs every file with its test.