Skip to content

Commit b0cf2ef

Browse files
Merge branch 'next' into feature/FOUR-8522
2 parents fb1aaea + 3bcbb3b commit b0cf2ef

141 files changed

Lines changed: 7208 additions & 2232 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-pm4.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ run-name: ${{ github.actor }} send deploy EKS 🚀
33
on:
44
pull_request:
55
types: [opened, reopened, synchronize, edited, closed]
6-
#schedule:
7-
# - cron: '30 2 * * *' # every day at midnight
6+
schedule:
7+
- cron: '30 2 * * *' # run daily
88
workflow_dispatch:
99
workflow_call:
1010
env:
@@ -15,10 +15,10 @@ env:
1515
pull_req_id: ${{github.event.pull_request.number}}
1616
DATE: $(date -d '-1 day' '+%Y-%m-%d'|sed 's/-//g')
1717
CURRENT_DATE: $(date '+%Y-%m-%d %H:%M:%S'|sed 's/-//g')
18-
CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'next' }}
19-
CI_PROJECT: ${{github.event.pull_request.head.repo.name || 'processmaker' }}
18+
CI_PACKAGE_BRANCH: ${{ github.event.pull_request.head.ref || github.event.ref || 'develop' }}
19+
CI_PROJECT: ${{github.event.pull_request.head.repo.name || github.event.repository.name || 'processmaker' }}
2020
CI_PR_BODY: ${{ github.event_name == 'schedule' && 'No ci tags needed here' || github.event.pull_request.body }}
21-
IMAGE_TAG: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g")
21+
IMAGE_TAG: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g" | sed "s/refs-heads-//g")
2222
DEPLOY: ${{ secrets.DEPLOY }}
2323
GH_USER: ${{ secrets.GH_USER }}
2424
GH_EMAIL: ${{ secrets.GH_EMAIL }}
@@ -27,7 +27,7 @@ env:
2727
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
2828
BUILD_BASE: ${{ (contains(github.event.pull_request.body, 'ci:build-base') || github.event_name == 'schedule') && '1' || '0' }}
2929
BASE_IMAGE: ${{ secrets.REGISTRY_HOST }}/processmaker/processmaker:base
30-
K8S_BRANCH: ${{ contains(github.event.pull_request.body, 'ci:next') && 'next' || 'develop' }}
30+
K8S_BRANCH: ${{ contains(github.event.pull_request.body, 'ci:next') && 'next' || 'develop' }}
3131
concurrency:
3232
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
3333
cancel-in-progress: true
@@ -48,7 +48,7 @@ jobs:
4848
- name: Generate image EKS
4949
run: |
5050
cd pm4-k8s-distribution/images
51-
branch=$CI_PACKAGE_BRANCH tag=${{env.IMAGE_TAG}} bash build.k8s-cicd.sh
51+
branch=$(echo "${{ env.CI_PACKAGE_BRANCH }}" | sed 's/refs-heads-//g') tag=${{env.IMAGE_TAG}} bash build.k8s-cicd.sh
5252
echo "VERSION=${{ env.IMAGE_TAG }}" >> $GITHUB_ENV
5353
- name: List Images
5454
run: |
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace ProcessMaker;
4+
5+
use ProcessMaker\Jobs\GenerateUserRecommendations;
6+
use ProcessMaker\Models\Recommendation;
7+
use ProcessMaker\Models\User;
8+
9+
class ApplyRecommendation
10+
{
11+
public function run(string $action, Recommendation $recommendation, User $user, array $params = [])
12+
{
13+
$query = $recommendation->baseQuery($user);
14+
15+
foreach ($query->get() as $task) {
16+
switch($action) {
17+
case 'mark_as_priority':
18+
$task->update(['is_priority' => true]);
19+
break;
20+
21+
case 'reassign_to_user':
22+
$task->reassign($params['to_user_id'], $user);
23+
break;
24+
25+
default:
26+
break;
27+
}
28+
}
29+
30+
// Generate recommendations again so updated tasks are considered
31+
GenerateUserRecommendations::dispatch($user->id);
32+
}
33+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace ProcessMaker\Console\Commands;
4+
5+
use Exception;
6+
use Illuminate\Support\Str;
7+
use Illuminate\Console\Command;
8+
use ProcessMaker\SyncRecommendations;
9+
10+
class SyncRecommendationsCommand extends Command
11+
{
12+
/**
13+
* The name and signature of the console command.
14+
*
15+
* @var string
16+
*/
17+
protected $signature = 'processmaker:sync-recommendations';
18+
19+
/**
20+
* The console command description.
21+
*
22+
* @var string
23+
*/
24+
protected $description = 'Syncs recommendations from GitHub';
25+
26+
public SyncRecommendations $syncRecommendations;
27+
28+
public function __construct(SyncRecommendations $syncRecommendations)
29+
{
30+
parent::__construct();
31+
32+
$this->syncRecommendations = $syncRecommendations;
33+
}
34+
35+
/**
36+
* Execute the console command.
37+
*/
38+
public function handle(): void
39+
{
40+
$this->line('Syncing recommendations from GitHub...');
41+
42+
try {
43+
$this->syncRecommendations->sync();
44+
} catch (Exception $e) {
45+
$this->error($e->getMessage());
46+
} finally {
47+
$this->line('Sync complete');
48+
}
49+
}
50+
}

ProcessMaker/Console/Kernel.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
use Illuminate\Console\Scheduling\Schedule;
66
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7-
use Illuminate\Support\Facades\Artisan;
8-
use ProcessMaker\Jobs\SyncDefaultTemplates;
9-
use ProcessMaker\Jobs\SyncWizardTemplates;
107

118
class Kernel extends ConsoleKernel
129
{
@@ -15,9 +12,7 @@ class Kernel extends ConsoleKernel
1512
*
1613
* @var array
1714
*/
18-
protected $commands = [
19-
// @todo Add our ProcessMaker specific commands to this list
20-
];
15+
protected $commands = [];
2116

2217
/**
2318
* Define the application's command schedule.
@@ -28,17 +23,24 @@ class Kernel extends ConsoleKernel
2823
protected function schedule(Schedule $schedule)
2924
{
3025
$schedule->command('bpmn:timer')
31-
->everyMinute()
32-
->onOneServer();
26+
->everyMinute()
27+
->onOneServer();
28+
29+
$schedule->command('processmaker:sync-recommendations')
30+
->dailyAt('12:00')
31+
->onOneServer();
3332

3433
$schedule->command('package-data-sources:delete-logs')
35-
->weekly();
34+
->weekly();
3635

37-
$schedule->command('processmaker:sync-default-templates --queue')->daily();
36+
$schedule->command('processmaker:sync-default-templates --queue')
37+
->daily();
3838

39-
$schedule->command('processmaker:sync-guided-templates --queue')->daily();
39+
$schedule->command('processmaker:sync-guided-templates --queue')
40+
->daily();
4041

41-
$schedule->command('processmaker:sync-screen-templates --queue')->daily();
42+
$schedule->command('processmaker:sync-screen-templates --queue')
43+
->daily();
4244
}
4345

4446
/**
@@ -49,6 +51,7 @@ protected function schedule(Schedule $schedule)
4951
protected function commands()
5052
{
5153
$this->load(__DIR__ . '/Commands');
54+
5255
require base_path('routes/console.php');
5356
}
5457
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace ProcessMaker\Facades;
4+
5+
use Illuminate\Support\Facades\Facade;
6+
7+
/**
8+
* @see \ProcessMaker\InboxRules\MatchingTasks
9+
*/
10+
class MatchingTasks extends Facade
11+
{
12+
/**
13+
* Get the registered name of the component.
14+
*
15+
* @return string
16+
*/
17+
protected static function getFacadeAccessor()
18+
{
19+
return MatchingTasks::class;
20+
}
21+
}

0 commit comments

Comments
 (0)