Website Synchronizer For Github
Synchronize a GitHub repository into a WordPress plugin directory through a secure webhook or a manual admin action.
by Jose Mortellaro · github.com/josemortellaro/website-synchronizer-for-github
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/josemortellaro/website-synchronizer-for-github/archive/refs/heads/main.zipSynchronize a GitHub repository into the WordPress plugins directory through a secure webhook or a manual admin action.
Description
Website Synchronizer For Github lets WordPress automatically deploy a plugin stored in a GitHub repository.
Once configured, the plugin can:
- Store the GitHub username, repository name, webhook secret, and GitHub token in WordPress settings.
- Expose a webhook endpoint that GitHub can call after repository updates.
- Download the latest repository archive from GitHub.
- Extract and copy the repository files into
wp-content/plugins/<repository-name>. - Run the synchronization manually from the WordPress admin area.
This is especially useful for custom plugins hosted on GitHub, including private repositories, where you want a simple update flow without uploading ZIP files manually or using FTP on each release.
Features
- WordPress admin settings page
- GitHub webhook endpoint
- Manual synchronization button
- Support for GitHub token-based repository downloads
- Support for GitHub signature validation and query-string token fallback
- Automatic extraction and deployment into the plugins directory
- Last synchronization status shown in the admin page
Installation
- Upload the plugin folder to
wp-content/plugins/. - Activate
Website Synchronizer For Githubfrom the WordPress Plugins screen. - Go to
Settings > Website Sync. - Enter:
GitHub UsernameRepository NameWebhook SecretGitHub Token
- Save the settings.
Configuration
After activation, configure the plugin from:
Settings > Website Sync
The plugin uses these values:
GitHub Username: the account or organization that owns the repository.Repository Name: the GitHub repository that contains the plugin code to deploy.Webhook Secret: the shared secret used to validate incoming webhook requests.GitHub Token: a GitHub token used to download the repository archive. This is required for private repositories and recommended for public repositories.
The plugin deploys the repository into:
wp-content/plugins/<repository-name>
GitHub Webhook Setup
To deploy automatically whenever the GitHub repository is updated:
- Open the GitHub repository.
- Go to
Settings > Webhooks. - Click
Add webhook. - Set the payload URL to the endpoint shown in the plugin settings page.
Standard endpoint:
https://your-site.com/wp-json/website-synchronizer-for-github/v1/deploy
If your hosting environment requires the query-token fallback, use:
https://your-site.com/wp-json/website-synchronizer-for-github/v1/deploy?token=YOUR_WEBHOOK_SECRET
- Set
Content typetoapplication/json. - Set the GitHub webhook secret to the same value used in the plugin settings.
- Choose
Just the push event. - Save the webhook.
After this, each push to the configured repository can trigger a deployment on the WordPress site.
How Automatic Updates Work
- You push changes to the GitHub repository.
- GitHub sends a webhook request to WordPress.
- The plugin validates the request.
- The plugin downloads the latest repository ZIP from GitHub.
- The ZIP is extracted into a temporary directory.
- The existing target plugin directory is replaced with the updated repository files.
- The latest version of the plugin is now deployed on the site.
Advantages
- Faster deployments without manual ZIP uploads
- A Git-based workflow for plugin delivery
- Support for private repositories
- Reduced manual work and lower deployment friction
- A repeatable deployment process
- Easy synchronization after every push
- Useful for custom client plugins and internal projects
Frequently Asked Questions
Does this update WordPress.org plugins?
No. This plugin is intended for custom plugins that you manage in your own GitHub repositories.
Does it work with private repositories?
Yes. Use a GitHub token with permission to read the repository contents.
What should I put in the repository?
The repository should already contain a valid WordPress plugin structure, including the main plugin file and plugin header.
What happens when a deployment runs?
The plugin downloads the repository archive, extracts it, removes the existing target plugin folder, and copies in the new files.
Why does the webhook work only with ?token=... on some servers?
Some hosting environments or security layers may strip GitHub signature headers before they reach WordPress. In that case, using the query-string token fallback is a practical workaround.
Can I run the deployment manually?
Yes. The settings page includes a Run Synchronization Now button.
Security Notes
- Use a strong webhook secret.
- Keep the GitHub token private.
- Give the GitHub token the minimum access required to read the repository.
- Prefer testing on staging before using automatic deployment on production.
- Be aware that deployment replaces the contents of the target plugin directory.
Troubleshooting
I get rest_no_route.
Make sure:
- the plugin is active
- the webhook URL is correct
- the site can access the WordPress REST API
- the endpoint path matches the one shown in the plugin settings
If needed, try the fallback REST format:
https://your-site.com/?rest_route=/website-synchronizer-for-github/v1/deploy
I get Invalid webhook secret.
Make sure:
- the plugin
Webhook Secretmatches the GitHub webhook secret exactly - or, if required by your hosting setup, the payload URL includes
?token=YOUR_WEBHOOK_SECRET
The repository does not download.
Check:
- the GitHub username and repository name
- the GitHub token
- the token permissions
- whether the repository is private and requires authenticated access
Changelog
1.0.0
- Initial release
- Added WordPress settings page
- Added GitHub webhook endpoint
- Added manual synchronization action
- Added repository download and deployment flow
- Added support for secret validation and token fallback