Skip to content

Commit 4f16960

Browse files
author
Dillon Nys
committed
chore: Add pub step check to custom if
1 parent cba6118 commit 4f16960

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

mono_repo/lib/src/commands/github/github_yaml.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,17 @@ extension on CIJobEntry {
317317
posix.join(package, workingDirectory),
318318
);
319319
}
320+
var condition = task.action?.condition;
321+
if (condition != null) {
322+
condition += " && steps.$pubStepId.conclusion == 'success'";
323+
}
320324
commandEntries.add(
321325
_CommandEntry(
322326
'$package; ${task.command}',
323327
_commandForOs(task.command),
324328
type: task.type,
325329
id: task.action?.id,
326-
ifCondition: task.action?.condition ??
330+
ifCondition: condition ??
327331
// Run this regardless of the success of other steps other than
328332
// the pub step.
329333
"always() && steps.$pubStepId.conclusion == 'success'",

mono_repo/test/generate_test.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ stages:
12511251
my-key: my-var
12521252
my-num: 123
12531253
my-map: {'abc':123}
1254-
if: always()
1254+
if: \${{ github.event_name == 'pull_request' }}
12551255
working-directory: ./tool
12561256
shell: fish
12571257
''')
@@ -1270,7 +1270,7 @@ stages:
12701270
my-key: my-var
12711271
my-num: "123"
12721272
my-map: "{\\"abc\\":123}"
1273-
if: always()
1273+
if: "\${{ github.event_name == 'pull_request' }} && steps.pkg_a_pub_upgrade.conclusion == 'success'"
12741274
working-directory: pkg_a/tool
12751275
run: "./script_a && ./script_b && ./script_c"
12761276
shell: fish
@@ -1305,7 +1305,8 @@ stages:
13051305
defaultGitHubWorkflowFilePath,
13061306
stringContainsInOrder([
13071307
'id: custom-script',
1308-
'if: always()',
1308+
'if: "always() && '
1309+
r"steps.pkg_a_pub_upgrade.conclusion == 'success'",
13091310
'working-directory: pkg_a/tool',
13101311
]),
13111312
)

0 commit comments

Comments
 (0)