mirror of
https://github.com/hernikplays/freelo-action.git
synced 2024-11-25 09:01:05 +01:00
fix: check for correct bot login
This commit is contained in:
parent
8208aeca44
commit
e033a1d4b5
2 changed files with 2 additions and 10 deletions
6
dist/index.js
vendored
6
dist/index.js
vendored
|
@ -45402,18 +45402,14 @@ try {
|
||||||
mediaType: {
|
mediaType: {
|
||||||
format: "html"
|
format: "html"
|
||||||
}
|
}
|
||||||
})).data.filter((i) => i.user?.type === "Bot");
|
})).data.filter((i) => i.user?.type === "Bot" && i.user.login === "github-actions[bot]");
|
||||||
console.log(comment2[0].user?.login);
|
|
||||||
if (comment2.length === 0)
|
if (comment2.length === 0)
|
||||||
break;
|
break;
|
||||||
console.log(comment2.length);
|
|
||||||
console.log(comment2[0].body_html);
|
|
||||||
const taskId2 = /https:\/\/app.freelo.io\/task\/(\d+)/.exec(comment2[0].body_html ?? "");
|
const taskId2 = /https:\/\/app.freelo.io\/task\/(\d+)/.exec(comment2[0].body_html ?? "");
|
||||||
if (!taskId2 || taskId2.length === 0) {
|
if (!taskId2 || taskId2.length === 0) {
|
||||||
console.log("Comment found, but no Freelo task ID identified");
|
console.log("Comment found, but no Freelo task ID identified");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
console.log(`${apiEndpoint}/task/${taskId2[1]}/finish`);
|
|
||||||
const res = await axios_default.post(`${apiEndpoint}/task/${taskId2[1]}/finish`, null, defaultOptions);
|
const res = await axios_default.post(`${apiEndpoint}/task/${taskId2[1]}/finish`, null, defaultOptions);
|
||||||
if (res.status > 399) {
|
if (res.status > 399) {
|
||||||
console.error(res.data);
|
console.error(res.data);
|
||||||
|
|
|
@ -133,12 +133,9 @@ try {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
).data.filter(
|
).data.filter(
|
||||||
(i) => i.user?.type === "Bot",
|
(i) => i.user?.type === "Bot" && i.user.login === "github-actions[bot]",
|
||||||
);
|
);
|
||||||
console.log(comment[0].user?.login)
|
|
||||||
if (comment.length === 0) break; // not a Freelo task, skip
|
if (comment.length === 0) break; // not a Freelo task, skip
|
||||||
console.log(comment.length);
|
|
||||||
console.log(comment[0].body_html);
|
|
||||||
|
|
||||||
// Finish task in Freelo
|
// Finish task in Freelo
|
||||||
const taskId = /https:\/\/app.freelo.io\/task\/(\d+)/.exec(
|
const taskId = /https:\/\/app.freelo.io\/task\/(\d+)/.exec(
|
||||||
|
@ -148,7 +145,6 @@ try {
|
||||||
console.log("Comment found, but no Freelo task ID identified");
|
console.log("Comment found, but no Freelo task ID identified");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
console.log(`${apiEndpoint}/task/${taskId[1]}/finish`)
|
|
||||||
const res = await axios.post(
|
const res = await axios.post(
|
||||||
`${apiEndpoint}/task/${taskId[1]}/finish`,
|
`${apiEndpoint}/task/${taskId[1]}/finish`,
|
||||||
null,
|
null,
|
||||||
|
|
Loading…
Reference in a new issue