Skip to content

Commit 50a0855

Browse files
Fix yamllint errors in merge automation workflows
- Remove trailing spaces from all workflow files - Quote 'on:' keywords to fix truthy warnings - Fix multiline string syntax in release-notes-label.yaml
1 parent e95fde5 commit 50a0855

File tree

6 files changed

+82
-78
lines changed

6 files changed

+82
-78
lines changed

.github/workflows/merge-automation/approval-labels.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Approval Label Management
33
# This workflow handles /lgtm and /approve commands in PR comments
44
# Replaces Prow Tide functionality for label-based approvals
55

6-
on:
6+
'on':
77
issue_comment:
88
types: [created]
99

@@ -18,34 +18,34 @@ jobs:
1818
# Only run on pull request comments
1919
if: github.event.issue.pull_request
2020
runs-on: ubuntu-latest
21-
21+
2222
steps:
2323
- name: Process approval commands
2424
uses: actions/github-script@v7
2525
with:
2626
script: |
2727
const comment_body = context.payload.comment.body.trim();
2828
const commenter = context.payload.comment.user.login;
29-
29+
3030
// Check if comment is an approval command
3131
const isLgtmCommand = comment_body.startsWith('/lgtm');
3232
const isApproveCommand = comment_body.startsWith('/approve');
33-
33+
3434
if (!isLgtmCommand && !isApproveCommand) {
3535
console.log('Not an approval command, skipping');
3636
return;
3737
}
38-
38+
3939
console.log(`Processing command from ${commenter}: ${comment_body}`);
40-
40+
4141
// React with eyes to show we're processing
4242
await github.rest.reactions.createForIssueComment({
4343
owner: context.repo.owner,
4444
repo: context.repo.repo,
4545
comment_id: context.payload.comment.id,
4646
content: 'eyes'
4747
});
48-
48+
4949
// Check user permissions
5050
let hasPermission = false;
5151
try {
@@ -54,39 +54,39 @@ jobs:
5454
repo: context.repo.repo,
5555
username: commenter
5656
});
57-
57+
5858
console.log(`User ${commenter} has permission: ${collaborator.permission}`);
5959
hasPermission = ['admin', 'write', 'maintain'].includes(collaborator.permission);
6060
} catch (error) {
6161
console.log(`Error checking permissions for ${commenter}:`, error.message);
6262
hasPermission = false;
6363
}
64-
64+
6565
// Handle insufficient permissions
6666
if (!hasPermission) {
6767
console.log(`User ${commenter} does not have sufficient permissions`);
68-
68+
6969
await github.rest.reactions.createForIssueComment({
7070
owner: context.repo.owner,
7171
repo: context.repo.repo,
7272
comment_id: context.payload.comment.id,
7373
content: 'confused'
7474
});
75-
75+
7676
await github.rest.issues.createComment({
7777
owner: context.repo.owner,
7878
repo: context.repo.repo,
7979
issue_number: context.issue.number,
8080
body: `@${commenter} you don't have permission to use approval commands. Only users with write access or higher can approve PRs.`
8181
});
82-
82+
8383
return;
8484
}
85-
85+
8686
// Process /lgtm command
8787
if (isLgtmCommand) {
8888
const isCancel = comment_body === '/lgtm cancel';
89-
89+
9090
if (isCancel) {
9191
try {
9292
await github.rest.issues.removeLabel({
@@ -96,7 +96,7 @@ jobs:
9696
name: 'lgtm'
9797
});
9898
console.log('Removed lgtm label');
99-
99+
100100
await github.rest.reactions.createForIssueComment({
101101
owner: context.repo.owner,
102102
repo: context.repo.repo,
@@ -114,7 +114,7 @@ jobs:
114114
labels: ['lgtm']
115115
});
116116
console.log('Added lgtm label');
117-
117+
118118
await github.rest.reactions.createForIssueComment({
119119
owner: context.repo.owner,
120120
repo: context.repo.repo,
@@ -123,11 +123,11 @@ jobs:
123123
});
124124
}
125125
}
126-
126+
127127
// Process /approve command
128128
if (isApproveCommand) {
129129
const isCancel = comment_body === '/approve cancel';
130-
130+
131131
if (isCancel) {
132132
try {
133133
await github.rest.issues.removeLabel({
@@ -137,7 +137,7 @@ jobs:
137137
name: 'approved'
138138
});
139139
console.log('Removed approved label');
140-
140+
141141
await github.rest.reactions.createForIssueComment({
142142
owner: context.repo.owner,
143143
repo: context.repo.repo,
@@ -155,7 +155,7 @@ jobs:
155155
labels: ['approved']
156156
});
157157
console.log('Added approved label');
158-
158+
159159
await github.rest.reactions.createForIssueComment({
160160
owner: context.repo.owner,
161161
repo: context.repo.repo,

.github/workflows/merge-automation/hold-label.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Hold Label Management
33
# Handles /hold and /unhold commands to block/unblock PRs from merging
44
# Replaces Prow hold plugin
55

6-
on:
6+
'on':
77
issue_comment:
88
types: [created]
99

@@ -17,34 +17,34 @@ jobs:
1717
name: Process hold commands
1818
if: github.event.issue.pull_request
1919
runs-on: ubuntu-latest
20-
20+
2121
steps:
2222
- name: Process hold commands
2323
uses: actions/github-script@v7
2424
with:
2525
script: |
2626
const comment_body = context.payload.comment.body.trim();
2727
const commenter = context.payload.comment.user.login;
28-
28+
2929
// Check if comment is a hold command
3030
const isHoldCommand = comment_body === '/hold';
3131
const isUnholdCommand = comment_body === '/unhold' || comment_body === '/hold cancel';
32-
32+
3333
if (!isHoldCommand && !isUnholdCommand) {
3434
console.log('Not a hold command, skipping');
3535
return;
3636
}
37-
37+
3838
console.log(`Processing hold command from ${commenter}: ${comment_body}`);
39-
39+
4040
// React with eyes to show we're processing
4141
await github.rest.reactions.createForIssueComment({
4242
owner: context.repo.owner,
4343
repo: context.repo.repo,
4444
comment_id: context.payload.comment.id,
4545
content: 'eyes'
4646
});
47-
47+
4848
// Check user permissions
4949
let hasPermission = false;
5050
try {
@@ -53,43 +53,43 @@ jobs:
5353
repo: context.repo.repo,
5454
username: commenter
5555
});
56-
56+
5757
console.log(`User ${commenter} has permission: ${collaborator.permission}`);
5858
hasPermission = ['admin', 'write', 'maintain'].includes(collaborator.permission);
5959
} catch (error) {
6060
console.log(`Error checking permissions for ${commenter}:`, error.message);
6161
hasPermission = false;
6262
}
63-
63+
6464
// Allow PR author to hold their own PR
6565
const pr = await github.rest.pulls.get({
6666
owner: context.repo.owner,
6767
repo: context.repo.repo,
6868
pull_number: context.issue.number
6969
});
70-
70+
7171
const isPrAuthor = pr.data.user.login === commenter;
72-
72+
7373
if (!hasPermission && !isPrAuthor) {
7474
console.log(`User ${commenter} does not have sufficient permissions and is not the PR author`);
75-
75+
7676
await github.rest.reactions.createForIssueComment({
7777
owner: context.repo.owner,
7878
repo: context.repo.repo,
7979
comment_id: context.payload.comment.id,
8080
content: 'confused'
8181
});
82-
82+
8383
await github.rest.issues.createComment({
8484
owner: context.repo.owner,
8585
repo: context.repo.repo,
8686
issue_number: context.issue.number,
8787
body: `@${commenter} you don't have permission to use hold commands. Only the PR author or users with write access can hold/unhold PRs.`
8888
});
89-
89+
9090
return;
9191
}
92-
92+
9393
// Process /hold command
9494
if (isHoldCommand) {
9595
await github.rest.issues.addLabels({
@@ -99,15 +99,15 @@ jobs:
9999
labels: ['do-not-merge/hold']
100100
});
101101
console.log('Added do-not-merge/hold label');
102-
102+
103103
await github.rest.reactions.createForIssueComment({
104104
owner: context.repo.owner,
105105
repo: context.repo.repo,
106106
comment_id: context.payload.comment.id,
107107
content: '+1'
108108
});
109109
}
110-
110+
111111
// Process /unhold command
112112
if (isUnholdCommand) {
113113
try {
@@ -118,7 +118,7 @@ jobs:
118118
name: 'do-not-merge/hold'
119119
});
120120
console.log('Removed do-not-merge/hold label');
121-
121+
122122
await github.rest.reactions.createForIssueComment({
123123
owner: context.repo.owner,
124124
repo: context.repo.repo,

.github/workflows/merge-automation/merge-readiness.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Merge Readiness Check
44
# when both 'lgtm' and 'approved' labels are present on the PR
55
# This enables auto-merge with GitHub merge queue
66

7-
on:
7+
'on':
88
pull_request:
99
types:
1010
- opened
@@ -23,7 +23,7 @@ jobs:
2323
check_merge_readiness:
2424
name: Check approval labels
2525
runs-on: ubuntu-latest
26-
26+
2727
steps:
2828
- name: Check for required labels and blocking labels
2929
id: check_labels
@@ -32,16 +32,16 @@ jobs:
3232
script: |
3333
const pr = context.payload.pull_request;
3434
const labels = pr.labels.map(label => label.name);
35-
35+
3636
console.log('PR Labels:', labels);
37-
37+
3838
// Required labels
3939
const hasLgtm = labels.includes('lgtm');
4040
const hasApproved = labels.includes('approved');
41-
41+
4242
console.log('Has lgtm:', hasLgtm);
4343
console.log('Has approved:', hasApproved);
44-
44+
4545
// Blocking labels that prevent merge
4646
const blockingLabels = [
4747
'do-not-merge/hold',
@@ -52,9 +52,9 @@ jobs:
5252
'needs-ok-to-test',
5353
'needs-rebase'
5454
];
55-
55+
5656
const presentBlockingLabels = labels.filter(label => blockingLabels.includes(label));
57-
57+
5858
if (presentBlockingLabels.length > 0) {
5959
console.log('❌ PR has blocking labels:', presentBlockingLabels.join(', '));
6060
core.setOutput('ready', 'false');
@@ -67,18 +67,18 @@ jobs:
6767
const missing = [];
6868
if (!hasLgtm) missing.push('lgtm');
6969
if (!hasApproved) missing.push('approved');
70-
70+
7171
console.log('❌ PR is missing required labels:', missing.join(', '));
7272
core.setOutput('ready', 'false');
7373
core.setOutput('message', `PR is not ready to merge - missing labels: ${missing.join(', ')}`);
7474
}
75-
75+
7676
- name: Set success status
7777
if: steps.check_labels.outputs.ready == 'true'
7878
run: |
7979
echo "✅ ${{ steps.check_labels.outputs.message }}"
8080
exit 0
81-
81+
8282
- name: Set failure status
8383
if: steps.check_labels.outputs.ready == 'false'
8484
run: |

0 commit comments

Comments
 (0)