Skip to content

Commit

Permalink
feat: draft option (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
lfgcampos authored Oct 2, 2024
1 parent 86ec176 commit 710ecfa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ inputs:
description: "Set to true if you want the title and body to be updated for an existing pull request"
default: "false"
required: false
draft:
description: "Set to true if you want the pull request to be in draft mode"
default: "false"
required: false

outputs:
pull-request-number:
Expand Down
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ async function main() {
team_reviewers: core.getInput("team_reviewers"),
autoMerge: core.getInput("auto-merge"),
updatePRTitleAndBody: core.getInput("update-pull-request-title-and-body"),
draft: core.getInput("draft"),
};

core.debug(`Inputs: ${inspect(inputs)}`);
Expand Down Expand Up @@ -185,6 +186,7 @@ async function main() {
body: inputs.body,
head: inputs.branch,
base: DEFAULT_BRANCH,
draft: inputs.draft === "true",
});

core.info(`Pull request created: ${html_url} (#${number})`);
Expand Down Expand Up @@ -223,7 +225,7 @@ async function main() {
core.info(`Assignees added: ${assignees.join(", ")}`);
core.debug(inspect(data));
}

if (inputs.reviewers || inputs.team_reviewers) {
let params = {
owner,
Expand All @@ -233,8 +235,8 @@ async function main() {
let reviewers = null;
let team_reviewers = null;

if(inputs.reviewers) {
core.debug(`Adding reviewers: ${inputs.reviewers}`)
if(inputs.reviewers) {
core.debug(`Adding reviewers: ${inputs.reviewers}`)
reviewers = (inputs.reviewers || "").trim().split(/\s*,\s*/);

params = {
Expand All @@ -244,7 +246,7 @@ async function main() {
};

if(inputs.team_reviewers) {
core.debug(`Adding team reviewers: ${inputs.team_reviewers}`)
core.debug(`Adding team reviewers: ${inputs.team_reviewers}`)
team_reviewers = (inputs.team_reviewers || "").trim().split(/\s*,\s*/);

params = {
Expand Down

0 comments on commit 710ecfa

Please sign in to comment.