-
Notifications
You must be signed in to change notification settings - Fork 36
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
Creating branches if branch is missing? #26
Comments
Hi, thanks for interesting question.
At the moment yes.
This would be a great addition though 👍 How does the code need to changed to make it happen? |
Hi @TomasVotruba!🙋🏼♂️ I've faced the same problem as the issue author. I've forked the repo and added in // $changedFiles is an array that contains the list of modified files, and is empty if there are no changes.
if ($changedFiles) {
note('Adding git commit');
+ exec_with_output_print(sprintf('git checkout %s || git checkout -b %s', $config->getBranch(), $config->getBranch()));
exec_with_output_print('git add .');
$message = sprintf('Pushing git commit with "%s" message to "%s"', $commitMessage, $config->getBranch());
note($message);
exec("git commit --message '$commitMessage'");
exec('git push --quiet origin ' . $config->getBranch());
} else {
note('No files to change');
} It might be written better but for PoC purposes is fine. I'm wondering how we should test this part of code, as testing it might be as problematic as described in #21. Finding the way how to test it is the last obstacle holding me back from opening PR. |
I see. If that's the case for more of you and you've been running the fix on your code, I think it's ok to put it in a PR 👍 |
@TomasVotruba yeah, my code is battle-tested :D. I'll open PR soon, thanks for the response! |
@TomasVotruba #29 should do the work, I've reworked a little bit the code from my previous comment and I've performed some manual tests. Everything seems to work perfectly 👍🏼. |
Hi I'm using this github action on my monorepo. Since it's still a WIP all I had is a main branch and I was pushing to other repositories to the main branch. Now I have a 1.0 branch so I can work on making a stable version and I run into issues with the monorepo split.
In the workflow I added:
This fails however as the repository I'm pushing to has no 1.0 branch (yet). Which results in this error:
Do I need to manually add these branches to all the child repositories? Or can this be done automatically?
The text was updated successfully, but these errors were encountered: