Skip to content

Commit

Permalink
Merge pull request #64 from dsambugaro/feat/allow-labels
Browse files Browse the repository at this point in the history
  • Loading branch information
TreTuna authored Sep 16, 2022
2 parents 9cf1bee + fdf9da3 commit 19c35d4
Show file tree
Hide file tree
Showing 4 changed files with 10,915 additions and 2,455 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ inputs:
description: "JSON array of GitHub team `slug`s that will be requested to review the PR. Example: '['js-team']'"
required: false
default: '[]'
LABELS:
description: "JSON array of label names that will be added to the PR. Example: '['sync']'"
required: false
default: '[]'
outputs:
PULL_REQUEST_URL:
description: "URL for either the generated pull request or the currently open one"
Expand Down
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function run() {
core.getInput("CONTENT_COMPARISON").toLowerCase() === "true";
const reviewers = JSON.parse(core.getInput("REVIEWERS"));
const team_reviewers = JSON.parse(core.getInput("TEAM_REVIEWERS"));
const labels = JSON.parse(core.getInput("LABELS"));

console.log(
`Should a pull request to ${toBranch} from ${fromBranch} be created?`
Expand Down Expand Up @@ -67,6 +68,15 @@ async function run() {
});
}

if (labels.length > 0) {
octokit.rest.issues.addLabels({
owner,
repo,
issue_number: pullRequest.number,
labels
})
}

console.log(
`Pull request (${pullRequest.number}) successful! You can view it here: ${pullRequest.url}`
);
Expand Down
Loading

0 comments on commit 19c35d4

Please sign in to comment.