Skip to content

Commit 91d2c56

Browse files
authored
Merge pull request #151 from fleetbase/dev-v1.6.12
fix scheduler to not run in CI or without database connection
2 parents a816ed3 + c520ab0 commit 91d2c56

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Create Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
7+
jobs:
8+
create:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Publish GitHub Release
13+
uses: softprops/action-gh-release@v2
14+
with:
15+
tag_name: ${{ github.ref_name }}
16+
name: ${{ github.ref_name }}
17+
generate_release_notes: true
18+
draft: false
19+
prerelease: false
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fleetbase/core-api",
3-
"version": "1.6.11",
3+
"version": "1.6.12",
44
"description": "Core Framework and Resources for Fleetbase API",
55
"keywords": [
66
"fleetbase",

src/Models/Setting.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ public function getCompany(): ?Company
470470
if (count($keySegments) >= 3 && $keySegments[0] === 'company' && Str::isUuid($keySegments[1])) {
471471
return Company::where('uuid', $keySegments[1])->first();
472472
}
473+
474+
return null;
473475
}
474476

475477
public function getUser(): ?User
@@ -478,5 +480,7 @@ public function getUser(): ?User
478480
if (count($keySegments) >= 3 && $keySegments[0] === 'user' && Str::isUuid($keySegments[1])) {
479481
return User::where('uuid', $keySegments[1])->first();
480482
}
483+
484+
return null;
481485
}
482486
}

src/Providers/CoreServiceProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,11 @@ public function registerCommands(): void
341341
*/
342342
public function scheduleCommands(?callable $callback = null): void
343343
{
344+
// Skip everything in CI / PHPUnit / pest
345+
if (app()->environment(['testing', 'ci']) || env('CI') || Setting::doesntHaveConnection()) {
346+
return;
347+
}
348+
344349
$this->app->booted(function () use ($callback) {
345350
$schedule = $this->app->make(Schedule::class);
346351

0 commit comments

Comments
 (0)