Hello,
I've gone threw the read me file and I'm having trouble creating a webhook to my theme hosted on gitbhub. I was able to install the theme with little trouble, however when I add RESTful endpoint with my theme tag I get this error:
{
"message": "Request tag and webhook are not matching.",
"error": true}
I'm not sure what I'm doing wrong. Any insight would be helpful.
You may have inadvertently reset your API key. Copy it again from the Remote Management tab.
Let me know.
{
"message": "Theme not found or not updatable with GitHub Updater: ChooseNJ",
"error": true
}
Does the theme have the correct headers?
It's using a custom header called header-choose.php
I mean the header to work with GitHub Updater.
Those would be in style.css
Oh no I haven't, what do I need to change?
Current header:
/*
Theme Name: Choose Nj Theme
Theme URI: http://choosenj.com
Author: Princeton Partners
Author URI: http://princetonpartners.com
Description: Custom theme for Choose New Jersey, 2016 -- built by Chris Gatherer, Justin Cheng, and Princeton Partners.
Base theme by Muffin group.
Template: betheme
Version: 1.6
*/
Also its a private repository, does that make a difference?
Chris, as in the README, you need to add a header GitHub Theme URI: with the URI to the theme's GitHub repo.
If it's a private repo you will also need to add a personal access token with read privileges to the Settings page.
I followed your instructions and I' receiving the same error:
"Request tag and webhook are not matching."
I've modified my theme URI:
/*
Theme Name: Choose Nj Theme
Theme URI: http://choosenj.com
Author: Princeton Partners
Author URI: http://princetonpartners.com
Description: Custom theme for Choose New Jersey, 2016 -- built by Chris Gatherer, Justin Cheng, and Princeton Partners.
Base theme by Muffin group.
Template: betheme
Version: 1.6
GitHub Theme URI: https://github.com/PPIGargoyles/ChooseNJ.git
GitHub Branch: Staging
*/
I also created a new personal access token under settings on Github and added read privileges. What am I missing?
Can you give afragen temporary access to the repo until we sort this out?
I add you as a collaborator.
Thanks Chris. I was able to update from the RESTful endpoint on my site without issue. Can you branch switch to the develop branch of GitHub Updater and try it?
I'm not exactly sure what you want me to do...I've clone the develop branch, but I'm not sure what to do from there. This is my first time doing this configuration.
I get this error when running the curl:
CGatherer:~ cgatherer$ curl "http://staging.choosenj.com/wp-admin/admin-ajax.php?action=github-updater-update&key=a0384519ff553ef407691d9dfafa41b9"
Error 406 - Not Acceptable Error 406 - Not Acceptable
Generally a 406 error is caused because a request has been blocked by Mod Security. If you believe that your request has been blocked by mistake please contact the web site owner.
From your admin dashboard under Settings you will see an entry for GitHub Updater. Go there. Select branch switching and save. Then go to the Plugins page and on GitHub Updater select the option to switch branches. Select the develop branch. The Settings are much different but still there.
Let me know when this is done.
I don't see that error on my end.
Okay that's done, what's next?

Your API key has been reset. Can you try again with the new API key?
Are you referring to my personal access token or RESTful Endpoint?
The RESTful endpoint.
Hey Andy,
Thanks for your help to this point. I have created a new webhook for my site, yet I'm still getting this error:
"message": "Request tag and webhook are not matching.",
"error": true
Could you tell me where I'm going wrong?
What can I do to help fix this? Can you again share your RESTful endpoint?
@PrincetonPartners is there anything further I can do to help or is this now solved?
Please re-open if I can help.
Hi guys... just saw this, since I have the same problem... Will investigate a bit...
@PrincetonPartners is this a public or private repo?
I'm having the same issue, and this is the first time I'm using it for a private repo. I have only used it for public repos before, so I'm thinking that this could be the reason.
@afragen If there are problems with the webhook functionality, please feel free to assign the issue to me so I get a notification. I completely missed this one.
Investigated a bit, and the exception is thrown here:
https://github.com/afragen/github-updater/blame/develop/src/GitHub_Updater/Rest_Update.php#L193
The code around that line looks like:
$webhook_response = $this->get_webhook_data();
if ( $webhook_response ) {
if ( $tag === $webhook_response['branch'] ) {
$tag = $webhook_response['hash'];
} else {
throw new \Exception( 'Request tag and webhook are not matching.' );
}
}
I don't remember if that code was something I put there, or if it was put there later. So, also not really sure what comparison that is and why $tag is supposed to be the same as $webhook_response['branch']. :) But I think I can solve it by some more investigation...
@afragen can you reopen this issue and assign it to me?
@limikael I added that code so that _any_ push wouldn't trigger an update. The logic is if the update is to branch2 and you are running branch1 then you would not get an update.
Not sure if I tested with a private repo either, but I know it works for public repos.
I also made a number of changes so that it now updates upon the creation of a release/tag. I did have a minor error, fixed in develop if the primary repo's branch was not master where that exception is thrown.
I closed this for lack of repose and that I was able to see it work from my end.
Mike are you doing this from a webhook or from the CLI?
From the webhook. It works fine from the CLI, the error only happens when GitHub is sending out the webhook.
Btw... I felt eager to work on this and maybe I took to much upon myself when I said I was going to look at it. Just want to give a heads up that I might not have time this week to work on it.
No problem. Can your up copy the payload and the response from GitHub? Either here or in a gist.
Payload: https://gist.github.com/limikael/ecd0232b5e1aae368086a71e595213c5
The response is simply:
{
"message": "Request tag and webhook are not matching.",
"error": true
}
What does the webhook look like? Please anonymize the key.
Looks like this:
http://securitysurvey.cloudaccess.host/wp-admin/admin-ajax.php?action=github-updater-update&plugin=security-compliance&key=xxx&tag=master
I have also tried without the tag=master, like this:
http://securitysurvey.cloudaccess.host/wp-admin/admin-ajax.php?action=github-updater-update&plugin=security-compliance&key=xxx
Same result.
Let me make a quick change to the develop branch to add a bit more info to the error. Then do the below.
Can you switch to the develop branch, push another commit, and show the payload and responses?
OK I should now get more info from the error. It will display the hash and branch being passed to the webhook.
I should only need the anonymized webhook and response.
e.g.
{
"message": "Request tag and webhook are not matching. Response: hash=0000000000000000000000000000000000000000, branch=skip-loaded",
"error": true
}
Ok! The time is 10pm here, will get the info first thing in the morning!
You can also just 'Redeliver' the webhook from within the GitHub Settings instead of making a new commit.
The response actually looks like this now:
{
"message": "Request tag and webhook are not matching. Response: branch=",
"error": true
}
The payload is here: https://gist.github.com/limikael/5f9dbac92878b19df944665625e1d89b
And the webhook is still:
http://securitysurvey.cloudaccess.host/wp-admin/admin-ajax.php?action=github-updater-update&plugin=security-compliance&key=xxx&tag=master
I just updated develop to provide some additional debug data for the webhook. Please update and let's try again.
It looks very odd that there is no branch shown after parsing. It also looks odd that there is no hash noted.
Actually... it is still the same... :(
{
"message": "Request tag and webhook are not matching. Response: branch=",
"error": true
}
Is that even possible or did I do some mistake?
@afragen also I just sent you an email with a suggestion...
Update. I think it's now fixed.
Confirmed! Seems to be working fine!
Huge thank you on behalf of Tunapanda.
@PrincetonPartners, giving you a mention here so you hopefully get a notification... Can you confirm that it is working too?