From 8bfaf7cd5bb7912640fa075daf76131e4c594de8 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Sun, 19 Nov 2023 19:32:43 +0100 Subject: [PATCH] Added more rights --- .gitea/workflows/maintenance.yaml | 3 +++ index.js | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/maintenance.yaml b/.gitea/workflows/maintenance.yaml index eb84419..386d48f 100644 --- a/.gitea/workflows/maintenance.yaml +++ b/.gitea/workflows/maintenance.yaml @@ -9,6 +9,9 @@ jobs: auto-update: name: pre-commit Autoupdate runs-on: pi64 + permissions: + contents: write + pull-requests: write steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 diff --git a/index.js b/index.js index 5f8c393..0f14fdf 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,6 @@ const core = require("@actions/core"); const _ = require("underscore"); -function Sleep(milliseconds) { - return new Promise((resolve) => setTimeout(resolve, milliseconds)); -} - async function getAndPostPullRequests() { try { core.info("Starting the action..."); @@ -54,7 +50,7 @@ async function getAndPostPullRequests() { assignees: assigneesInput ? assigneesInput.split(",") : undefined, // Changed to be omitted if empty labels: labelsInput ? labelsInput.split(",").map(Number) : undefined, // Changed to be omitted if empty due_date: dueDate || undefined, // Changed to be omitted if empty - milestone: milestone ? parseInt(milestone, 10) : 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}`, { @@ -78,7 +74,6 @@ async function getAndPostPullRequests() { core.info(`URL for POST request: ${url}`); core.info(`POST data being sent: ${JSON.stringify(postData, null, 2)}`); - await Sleep(50000); const postResponse = await fetch(url, { method: "POST", headers,