Added some more changes.
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Has been cancelled
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Has been cancelled
This commit is contained in:
parent
1d1a39cf17
commit
15f375f907
@ -17,8 +17,6 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- run: pre-commit autoupdate
|
- run: pre-commit autoupdate
|
||||||
shell: bash
|
shell: bash
|
||||||
- run: echo "Github token -> ${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
- run: sleep 50000
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: 'chore: update pre-commit hooks'
|
commit_message: 'chore: update pre-commit hooks'
|
||||||
|
16
index.js
16
index.js
@ -1,6 +1,10 @@
|
|||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const _ = require("underscore");
|
const _ = require("underscore");
|
||||||
|
|
||||||
|
function Sleep(milliseconds) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
||||||
|
}
|
||||||
|
|
||||||
async function getAndPostPullRequests() {
|
async function getAndPostPullRequests() {
|
||||||
try {
|
try {
|
||||||
core.info("Starting the action...");
|
core.info("Starting the action...");
|
||||||
@ -29,6 +33,7 @@ async function getAndPostPullRequests() {
|
|||||||
Authorization: `token ${githubToken}`,
|
Authorization: `token ${githubToken}`,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
};
|
};
|
||||||
|
core.info(`token ${githubToken}`);
|
||||||
// Logic for current branch
|
// Logic for current branch
|
||||||
if (!branch) {
|
if (!branch) {
|
||||||
const ref = process.env.GITHUB_REF;
|
const ref = process.env.GITHUB_REF;
|
||||||
@ -51,14 +56,15 @@ async function getAndPostPullRequests() {
|
|||||||
due_date: dueDate || 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) : undefined, // Changed to be omitted if empty
|
||||||
};
|
};
|
||||||
|
|
||||||
// Perform the GET request to check if a similar PR exists
|
// Perform the GET request to check if a similar PR exists
|
||||||
const getResponse = await fetch(`${url}?state=open&head=${branch}`, {
|
const getResponse = await fetch(`${url}?state=open&head=${branch}`, {
|
||||||
headers,
|
headers,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!getResponse.ok) {
|
if (!getResponse.ok) {
|
||||||
throw new Error(`HTTP error! status: ${getResponse.status}`);
|
throw new Error(
|
||||||
|
`HTTP error! status on checking the PR request status: ${getResponse.status}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const pulls = await getResponse.json();
|
const pulls = await getResponse.json();
|
||||||
@ -72,7 +78,7 @@ async function getAndPostPullRequests() {
|
|||||||
|
|
||||||
core.info(`URL for POST request: ${url}`);
|
core.info(`URL for POST request: ${url}`);
|
||||||
core.info(`POST data being sent: ${JSON.stringify(postData, null, 2)}`);
|
core.info(`POST data being sent: ${JSON.stringify(postData, null, 2)}`);
|
||||||
|
await Sleep(50000);
|
||||||
const postResponse = await fetch(url, {
|
const postResponse = await fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
@ -84,7 +90,9 @@ async function getAndPostPullRequests() {
|
|||||||
core.info(`POST response body: ${postResponseText}`);
|
core.info(`POST response body: ${postResponseText}`);
|
||||||
|
|
||||||
if (!postResponse.ok) {
|
if (!postResponse.ok) {
|
||||||
throw new Error(`HTTP error! status: ${postResponse.status}`);
|
throw new Error(
|
||||||
|
`HTTP error! status on creating a new PR: ${postResponse.status}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const postResult = await postResponse.json();
|
const postResult = await postResponse.json();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user