Require this package with composer.
composer require jubeki/orbit-git
The service provider will be automatically registered using package discovery.
If you don't use auto-discovery you should add the service provider to the providers array in config/app.php
.
// existing providers...
Jubeki\OrbitGit\OrbitGitServiceProvider::class,
By default, Orbit will use the system's name and email address when making commits to your repository. If you wish to change the name, use the ORBIT_GIT_NAME
and ORBIT_GIT_EMAIL
environment variables.
If you would like to use a more dynamic name and email address, you can use the OrbitGit::resolveNameUsing
and Orbit::resolveEmailUsing
methods instead:
use Jubeki\OrbitGit\Facades\OrbitGit;
public function boot()
{
OrbitGit::resolveNameUsing(function () {
return Auth::user()->name;
});
OrbitGit::resolveEmailUsing(function () {
return Auth::user()->email;
});
}
The default is [AUTO] {event} {model} {primary_key}
. You can also change the commit message with the OrbitGit::resolveMessageUsing
method.
use Jubeki\OrbitGit\Facades\OrbitGit;
public function boot()
{
OrbitGit::resolveMessageUsing(function ($event) {
return (string) Str::of(config('orbit-git.message_template'))
->replace('{event}', $this->getTypeOfEvent($event))
->replace('{model}', class_basename($event->model))
->replace('{primary_key}', $event->model->getKey());
});
}
You can also overwrite messages for specific events which has a higher priority than the default OrbitGit::resolveMessageUsing
method:
use Jubeki\OrbitGit\Facades\OrbitGit;
public function boot()
{
OrbitGit::resolveCreatedMessageUsing(function ($event) {
return '...',
});
OrbitGit::resolveDeletedMessageUsing(function ($event) {
return '...',
});
OrbitGit::resolveForceDeletedMessageUsing(function ($event) {
return '...',
});
OrbitGit::resolveUpdatedMessageUsing(function ($event) {
return '...',
});
}
You can add the following to the top of your deployment script to skip the deployment from commits made using Orbit on the production system.
if [[ $FORGE_DEPLOY_MESSAGE =~ ^\[AUTO\](.*)$ ]]; then
echo "AUTOMATED COMMIT FROM THE SERVER DO NOT DEPLOY!!!"
exit 0
fi
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
- Commit only changed file by event instead of complete path
- Only push if wanted
- Allow queuing of Git commits (possible risk of timing issued if multiple people update the same model at the same time)
- Julius Kiekbusch
- Ryan Chandler (Implemented Orbit and the original Git Integration)
- All Contributors
The MIT License (MIT). Please see License File for more information.