From 9365d681df1981a2271f1a94e6cbbbda5a65df52 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Sun, 19 Nov 2023 22:55:53 +0100 Subject: [PATCH] Tests for the default value of github actions. --- .gitea/workflows/maintenance.yaml | 2 +- action.yml | 1 + index.js | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index b45aeb5..e861541 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -56,7 +56,7 @@ jobs: token: ${{ secrets.REPO_TOKEN }} branch: update/pre-commit-hooks title: My PR Title - body: My PR Body + # body: My PR Body assignees: Philipp reviewers: Philipp labels: chore diff --git a/action.yml b/action.yml index 260d44a..3eb9b2a 100644 --- a/action.yml +++ b/action.yml @@ -16,6 +16,7 @@ inputs: body: description: Body of the pull request required: false + default: Some default tile! assignees: description: Comma-separated list of assignees for the pull request required: false diff --git a/index.js b/index.js index ea27198..313b3d7 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ async function getAndPostPullRequests() { const title = core.getInput("title"); const body = core.getInput("body") || ""; const assigneesInput = core.getInput("assignees"); + const reviewersInput = core.getIDToken("reviewers"); const dueDate = core.getInput("due_date"); const milestone = core.getInput("milestone"); const token = core.getInput("token"); @@ -31,7 +32,6 @@ async function getAndPostPullRequests() { accept: "application/json", }; core.info(`token ${token}`); - // Logic for current branch // Prepare POST data const postData = { @@ -39,15 +39,15 @@ async function getAndPostPullRequests() { body: body, head: branch, base: base_branch, - assignees: assigneesInput ? assigneesInput.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 + assignees: assigneesInput ? assigneesInput.split(",") : [], + reviewers: reviewersInput ? reviewersInput.split(",") : [], + due_date: dueDate || undefined, + milestone: milestone ? parseInt(milestone, 10) : 0, }; // Perform the POST request core.info(`URL for POST request: ${url}`); core.info(`POST data being sent: ${JSON.stringify(postData, null, 2)}`); - core.info(`URL with token: ${url}?access_token=${token}`); const postResponse = await fetch(`${url}?access_token=${token}`, { method: "POST", headers,