@@ -35,17 +35,30 @@ jobs:
35
35
36
36
if (prs.data.length > 0) {
37
37
const pr = prs.data[0];
38
- core.setOutput('pr_number', pr.number);
39
- core.setOutput('found', 'true');
40
- console.log(`Found PR #${pr.number}`);
38
+
39
+ // Check if PR has the deploy-canary label
40
+ const labels = pr.labels.map(label => label.name);
41
+ const hasCanaryLabel = labels.includes('deploy-canary');
42
+
43
+ if (hasCanaryLabel) {
44
+ core.setOutput('pr_number', pr.number);
45
+ core.setOutput('found', 'true');
46
+ core.setOutput('has_canary_label', 'true');
47
+ console.log(`Found PR #${pr.number} with deploy-canary label`);
48
+ } else {
49
+ core.setOutput('found', 'false');
50
+ core.setOutput('has_canary_label', 'false');
51
+ console.log(`Found PR #${pr.number} but it doesn't have deploy-canary label`);
52
+ }
41
53
} else {
42
54
core.setOutput('found', 'false');
55
+ core.setOutput('has_canary_label', 'false');
43
56
console.log('No associated PR found');
44
57
}
45
58
46
59
# Extract canary info from the workflow run
47
60
- name : Extract canary info
48
- if : ${{ steps.pr-info.outputs.found == 'true' && github.event.workflow_run.conclusion == 'success' }}
61
+ if : ${{ steps.pr-info.outputs.found == 'true' && steps.pr-info.outputs.has_canary_label == 'true' && github.event.workflow_run.conclusion == 'success' }}
49
62
id : canary-info
50
63
uses : actions/github-script@v7
51
64
with :
67
80
68
81
# Find existing comment
69
82
- name : Find existing comment
70
- if : ${{ steps.pr-info.outputs.found == 'true' }}
83
+ if : ${{ steps.pr-info.outputs.found == 'true' && steps.pr-info.outputs.has_canary_label == 'true' }}
71
84
uses : peter-evans/find-comment@v3
72
85
id : find-comment
73
86
with :
77
90
78
91
# Create or update comment based on workflow status
79
92
- name : Create or update canary comment
80
- if : ${{ steps.pr-info.outputs.found == 'true' }}
93
+ if : ${{ steps.pr-info.outputs.found == 'true' && steps.pr-info.outputs.has_canary_label == 'true' }}
81
94
uses : peter-evans/create-or-update-comment@v4
82
95
with :
83
96
comment-id : ${{ steps.find-comment.outputs.comment-id }}
0 commit comments