From c17dce6a797f6896dbabda7492173d619360571c Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Sun, 19 Nov 2023 22:36:42 +0100 Subject: [PATCH] Added PR actions --- .gitea/workflows/maintenance.yaml | 1 + action.yml | 4 ++++ index.js | 9 ++++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index 130dcf9..b45aeb5 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -59,3 +59,4 @@ jobs: body: My PR Body assignees: Philipp reviewers: Philipp + labels: chore diff --git a/action.yml b/action.yml index 260d44a..c0b1f53 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,10 @@ inputs: description: Comma-separated list of reviewers for the pull request required: false default: '' + labels: + desdescription: Comma-separated list of labels for the pull request + required: false + default: '' outputs: pull_request_url: description: URL of the created pull request diff --git a/index.js b/index.js index 5102451..b772caa 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,4 @@ const core = require("@actions/core"); -const _ = require("underscore"); async function getAndPostPullRequests() { try { @@ -41,10 +40,10 @@ async function getAndPostPullRequests() { body: body, head: branch, base: base_branch, - // assignees: assigneesInput ? assigneesInput.split(",") : [], // Changed to be omitted if empty - // labels: labelsInput ? labelsInput.split(",").map(Number) : [], // Changed to be omitted if empty - // due_date: dueDate || undefined, // Changed to be omitted if empty - // milestone: milestone ? parseInt(milestone, 10) : 0, // Changed to be omitted if empty + assignees: assigneesInput ? assigneesInput.split(",") : [], // Changed to be omitted if empty + labels: labelsInput ? labelsInput.split(",") : [], // Changed to be omitted if empty + due_date: dueDate || undefined, // Changed to be omitted if empty + milestone: milestone ? parseInt(milestone, 10) : 0, // Changed to be omitted if empty }; // Perform the GET request to check if a similar PR exists const getResponse = await fetch(`${url}?state=open&head=${branch}`, {