Skip to content

Commit

Permalink
Merge pull request #719 from peter-evans/add-to-lists
Browse files Browse the repository at this point in the history
fix: add to labels and assignees instead of resetting
  • Loading branch information
peter-evans committed Feb 8, 2021
2 parents 5e9d0ee + c27ea51 commit 34371f0
Show file tree
Hide file tree
Showing 3 changed files with 7,960 additions and 18 deletions.
14 changes: 6 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,22 +975,20 @@ class GitHubHelper {
const headBranch = `${headOwner}:${inputs.branch}`;
// Create or update the pull request
const pull = yield this.createOrUpdate(inputs, baseRepository, headBranch);
// Set milestone, labels and assignees
const updateIssueParams = {};
// Apply milestone
if (inputs.milestone) {
updateIssueParams['milestone'] = inputs.milestone;
core.info(`Applying milestone '${inputs.milestone}'`);
yield this.octokit.issues.update(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number, milestone: inputs.milestone }));
}
// Apply labels
if (inputs.labels.length > 0) {
updateIssueParams['labels'] = inputs.labels;
core.info(`Applying labels '${inputs.labels}'`);
yield this.octokit.issues.addLabels(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number, labels: inputs.labels }));
}
// Apply assignees
if (inputs.assignees.length > 0) {
updateIssueParams['assignees'] = inputs.assignees;
core.info(`Applying assignees '${inputs.assignees}'`);
}
if (Object.keys(updateIssueParams).length > 0) {
yield this.octokit.issues.update(Object.assign(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number }), updateIssueParams));
yield this.octokit.issues.addAssignees(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number, labels: inputs.assignees }));
}
// Request reviewers and team reviewers
const requestReviewersParams = {};
Expand Down

0 comments on commit 34371f0

Please sign in to comment.