Skip to content

Commit 34371f0

Browse files
authored
Merge pull request #719 from peter-evans/add-to-lists
fix: add to labels and assignees instead of resetting
2 parents 5e9d0ee + c27ea51 commit 34371f0

File tree

3 files changed

+7960
-18
lines changed

3 files changed

+7960
-18
lines changed

dist/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -975,22 +975,20 @@ class GitHubHelper {
975975
const headBranch = `${headOwner}:${inputs.branch}`;
976976
// Create or update the pull request
977977
const pull = yield this.createOrUpdate(inputs, baseRepository, headBranch);
978-
// Set milestone, labels and assignees
979-
const updateIssueParams = {};
978+
// Apply milestone
980979
if (inputs.milestone) {
981-
updateIssueParams['milestone'] = inputs.milestone;
982980
core.info(`Applying milestone '${inputs.milestone}'`);
981+
yield this.octokit.issues.update(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number, milestone: inputs.milestone }));
983982
}
983+
// Apply labels
984984
if (inputs.labels.length > 0) {
985-
updateIssueParams['labels'] = inputs.labels;
986985
core.info(`Applying labels '${inputs.labels}'`);
986+
yield this.octokit.issues.addLabels(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number, labels: inputs.labels }));
987987
}
988+
// Apply assignees
988989
if (inputs.assignees.length > 0) {
989-
updateIssueParams['assignees'] = inputs.assignees;
990990
core.info(`Applying assignees '${inputs.assignees}'`);
991-
}
992-
if (Object.keys(updateIssueParams).length > 0) {
993-
yield this.octokit.issues.update(Object.assign(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number }), updateIssueParams));
991+
yield this.octokit.issues.addAssignees(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number, labels: inputs.assignees }));
994992
}
995993
// Request reviewers and team reviewers
996994
const requestReviewersParams = {};

0 commit comments

Comments
 (0)