Skip to content

Commit 1b09890

Browse files
committed
support for target-commit
1 parent cd14548 commit 1b09890

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/Console/DuskCommand.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class DuskCommand extends BaseDuskCommand
1616
protected $signature = 'dusk
1717
{--without-tty : Disable output to TTY}
1818
{--without-percy : Disable percy snapshots}
19-
{--percy-target-branch : Set the base branch for comparison}';
19+
{--percy-target-branch : Set the base branch for comparison}
20+
{--percy-target-commit : Set the base commit SHA for comparison}';
2021

2122
/**
2223
* Execute the console command.
@@ -70,7 +71,8 @@ protected function env()
7071
{
7172
return array_filter([
7273
'PERCY_TOKEN' => env('PERCY_TOKEN'),
73-
'PERCY_TARGET_BRANCH' => $this->baseBranch()
74+
'PERCY_TARGET_BRANCH' => $this->baseBranch(),
75+
'PERCY_TARGET_COMMIT' => $this->targetCommit()
7476
]);
7577
}
7678

@@ -84,6 +86,13 @@ protected function baseBranch()
8486
: env('PERCY_TARGET_BRANCH');
8587
}
8688

89+
protected function targetCommit()
90+
{
91+
return $this->hasOption('percy-target-commit')
92+
? $this->option('percy-target-commit')
93+
: env('PERCY_TARGET_COMMIT');
94+
}
95+
8796
/**
8897
* @return Process
8998
*/
@@ -101,7 +110,7 @@ protected function processOptions()
101110
{
102111
return array_diff(
103112
array_slice($_SERVER['argv'], 2),
104-
['--without-tty', '--without-percy', '--percy-target-branch']
113+
['--without-tty', '--without-percy', '--percy-target-branch', '--percy-target-commit']
105114
);
106115
}
107116
}

src/Console/DuskFailsCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class DuskFailsCommand extends DuskCommand
1212
protected $signature = 'dusk:fails
1313
{--without-tty : Disable output to TTY}
1414
{--without-percy : Disable percy snapshots}
15-
{--percy-target-branch : Set the base branch for comparison}';
15+
{--percy-target-branch : Set the base branch for comparison}
16+
{--percy-target-commit : Set the base commit SHA for comparison}';
1617

1718
/**
1819
* The console command description.

0 commit comments

Comments
 (0)