Added a few arguments.
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 31s
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 31s
This commit is contained in:
parent
0f232d312e
commit
83d6ebd22a
33
index.js
33
index.js
@ -16,13 +16,27 @@ async function getAndPostPullRequests() {
|
|||||||
core.getInput("repo") || process.env.GITHUB_REPOSITORY.split("/")[1];
|
core.getInput("repo") || process.env.GITHUB_REPOSITORY.split("/")[1];
|
||||||
core.info(`Repository Name: ${repo}`);
|
core.info(`Repository Name: ${repo}`);
|
||||||
|
|
||||||
const branch = core.getInput("branch");
|
|
||||||
const base_branch = core.getInput("base_branch") || "main";
|
const base_branch = core.getInput("base_branch") || "main";
|
||||||
|
const assigneesInput = core.getInput("assignees");
|
||||||
|
const reviewersInput = core.getInput("reviewers");
|
||||||
|
const labelsInput = core.getInput("labels");
|
||||||
|
const githubToken = core.getInput("github_token");
|
||||||
|
|
||||||
|
const branch = core.getInput("branch");
|
||||||
|
if (!branch) {
|
||||||
|
const ref = process.env.GITHUB_REF;
|
||||||
|
if (ref && ref.startsWith("refs/heads/")) {
|
||||||
|
branch = ref.replace("refs/heads/", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
core.info(`The branch ${branch} should be merged into ${base_branch} .`);
|
core.info(`The branch ${branch} should be merged into ${base_branch} .`);
|
||||||
|
if (!body) {
|
||||||
|
core.warning("Warning: PR body is empty.");
|
||||||
|
}
|
||||||
|
|
||||||
// core.info(`Post Data: ${JSON.stringify(postData)}`);
|
// core.info(`Post Data: ${JSON.stringify(postData)}`);
|
||||||
|
|
||||||
const githubToken = core.getInput("github_token");
|
|
||||||
core.info("GitHub token retrieved.");
|
core.info("GitHub token retrieved.");
|
||||||
|
|
||||||
// Headers with Authorization
|
// Headers with Authorization
|
||||||
@ -56,7 +70,20 @@ async function getAndPostPullRequests() {
|
|||||||
core.info(
|
core.info(
|
||||||
`No open pulls found, to merge ${branch} into ${base_branch}. Trying to create a new PR.`,
|
`No open pulls found, to merge ${branch} into ${base_branch}. Trying to create a new PR.`,
|
||||||
);
|
);
|
||||||
return { message: "Abort for thesting" };
|
// return { message: "Abort for thesting" };
|
||||||
|
// Perform the POST request
|
||||||
|
// Prepare POST data
|
||||||
|
const postData = {
|
||||||
|
title: title,
|
||||||
|
body: body,
|
||||||
|
head: branch,
|
||||||
|
base: base_branch,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (assigneesInput) postData.assignees = assigneesInput.split(",");
|
||||||
|
if (reviewersInput) postData.reviewers = reviewersInput.split(",");
|
||||||
|
if (labelsInput) postData.labels = labelsInput.split(",");
|
||||||
|
|
||||||
// Perform the POST request
|
// Perform the POST request
|
||||||
const postResponse = await fetch(url, {
|
const postResponse = await fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user