-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
=== ERROR: Pushed branch does not match BRANCH === #23
Comments
Same here |
¿Do you have more info about this? |
Hi Edo/Vincenteguerra I've found the error in the script and solved it, As it looks like JSON Structure from bitbucket/git has changed and cannot read response properly from branch. Try replacing the whole IF section with following code: foreach ($json["push"]["changes"] as $change) {
if (
(
isset($change["old"]["type"])
&& isset($change["old"]["name"])
&& $change["old"]["type"] == "branch"
&& $change["old"]["name"] == "master"
)
|| (
isset($change["new"]["type"])
&& isset($change["new"]["name"])
&& $change["new"]["type"] == "branch"
&& $change["new"]["name"] == "master"
)
) {
exec("git pull https://YOUR_GIT_USERNAME:[email protected]/YOUR_GIT_USER/GIT_NAME.git YOUR_BRANCH_NAME");
die("Complete.");
}
} you can structure your code as per vicenteguerra script as well but i've reduced my script code as i'm just going to pull from specific branch when webhook is called |
Same here with bitbucket |
Hi @vatsh95 I have the error"Unexpected 'else' (74, 3)" and "syntax error, unexpected 'else' (T_ELSE) (74, 9)" |
As all changes should relate to the same branch I would think, maybe a check like |
@vicenteguerra do you have any plans to support merge request events? With gitlab the property to compare is "target_branch" instead of "ref". |
@aanderse can you open a new issue for that? |
I am using Bitbucket, and I still get an error. Which part is the problem? :( ##deployer.php |
I just tried to set this up for a GitHub repository and it's failing. Printing out the array $json returns nothing. Am I missing anything? |
This is because I didn't RTFM. Forgot to change the Content Type to json on the Webhooks screen in the repository. Shwoopsie! |
Any status updates on this issue? It's still broken for Bitbucket. |
Add this line in deployer.php on line 10:
That worked for me. |
Could you be more specific with this? On line 10 in deployer.php I see this:
What version do you have? |
I added it before the comment: $DIR = preg_match("//$/", DIR) ? DIR : DIR . "/"; // bitbucket ref issue #23 // retrieve the token |
hey , i was getting the same error , and after a few hours i was trying different changes in the code to figure out what was the problem (fun fact it was me) I realized that i was having the Content type from the github webhook settings set to application/x-www-form-urlencoded. |
Are you using bitbucket or github ? |
Github |
Hi, Same here with gitlab === ERROR: Pushed branch does not match BRANCH === |
Are you talking about deployer.php? |
I can't understand why it is giving me the error... I successfully pulled manually using git, but the script gives me this error everytime i run it.
Any help?
The text was updated successfully, but these errors were encountered: