Skip to content

Commit 0a52c47

Browse files
committed
Copy over community-contribution label from closing PR to issue
1 parent f8d2760 commit 0a52c47

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/label-and-milestone-issues.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,26 @@ jobs:
152152
// (don't filter by state to avoid race conditions where GitHub
153153
// hasn't closed the issue yet when this workflow runs)
154154
const errors = [];
155+
const labelsToApply = [];
155156
if (label) {
157+
labelsToApply.push(label);
158+
}
159+
// If the PR has the community-contribution label, propagate it to closing issues
160+
if (context.payload.pull_request.labels.some(l => l.name === 'community-contribution')) {
161+
labelsToApply.push('community-contribution');
162+
}
163+
if (labelsToApply.length > 0) {
156164
for (const issue of closingIssues) {
157-
console.log(`Adding label '${label}' to issue #${issue.number}`);
165+
console.log(`Adding labels [${labelsToApply.join(', ')}] to issue #${issue.number}`);
158166
try {
159167
await github.rest.issues.addLabels({
160168
owner,
161169
repo,
162170
issue_number: issue.number,
163-
labels: [label]
171+
labels: labelsToApply
164172
});
165173
} catch (error) {
166-
errors.push(`Failed to add label to issue #${issue.number}: ${error.message}`);
174+
errors.push(`Failed to add labels to issue #${issue.number}: ${error.message}`);
167175
}
168176
}
169177
}

0 commit comments

Comments
 (0)