commit 0c3817ffc438e1d519aa135681dbb5c294848d26
parent bdda1550c5d489f078d539f36d6397d3a8c12b79
Author: iostpa <iostpa@iostpa.com>
Date: Sun, 3 May 2026 11:56:53 +0300
Merge pull request #45 from iostpa/label-system
Fix a bug where `status: needs preview` wasn't adding the message
Diffstat:
5 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/.forgejo/workflows/publish-release.yml b/.github/workflows/publish-release.yml
diff --git a/.forgejo/workflows/publish.yml b/.github/workflows/publish.yml
diff --git a/index.js b/index.js
@@ -20,7 +20,6 @@ const mergedPRs = fs.readFileSync('./message/merged.md', 'utf8');
const draftPRs = fs.readFileSync('./message/draft.md', 'utf8');
const lowPriorityMessage = fs.readFileSync('./message/label/lowpriority.md', 'utf8');
const ignoreLabels = ["maintainer"];
-const statusLabels = ["status: low priority", "status: needs preview", "status: denied", "status: invalid"];
const reasonLabels = ["reason: abuse risk", "reason: commercial usage", "reason: impersonation", "reason: inaccessible website", "reason: incomplete pr", "reason: incomplete website", "reason: invalid file", "reason: invalid records", "reason: invalid social", "reason: merge conflict", "reason: not dev related", "reason: nsfw", "reason: other", "reason: unauthorized"];
Sentry.init({
@@ -92,14 +91,12 @@ app.webhooks.on('pull_request.opened', async ({ octokit, payload }) => {
// Label system
app.webhooks.on('pull_request.labeled', async ({ octokit, payload }) => {
- let preview, denied, invalid, lowpriority;
- if (payload.label.name === statusLabels[1]){
- preview = true;
- } else if (payload.label.name === statusLabels[2]) {
+ let denied, invalid, lowpriority;
+ if (payload.label.name === "status: denied") {
denied = true;
- } else if (payload.label.name === statusLabels[3]) {
+ } else if (payload.label.name === "status: invalid") {
invalid = true;
- } else if (payload.label.name === statusLabels[0]) {
+ } else if (payload.label.name === "status: low priority") {
lowpriority = true;
}
@@ -128,14 +125,12 @@ app.webhooks.on('pull_request.labeled', async ({ octokit, payload }) => {
let finalReason = initialReason.replace(/\s+/g, '-');
let message = fs.readFileSync(`./message/label/${finalReason}.md`, 'utf8');
allMessages.push(message);
- }
+ } else if (listOfLabels[i] === "status: needs preview") {
+ let message = fs.readFileSync(`./message/label/needs-preview.md`, 'utf8');
+ allMessages.push(message);
+ };
}
- if (preview === true && !listOfLabels.includes("reason: inaccessible website")) {
- let message = fs.readFileSync(`./message/label/inaccessible-website.md`, 'utf8');
- allMessages.push(message);
- };
-
const labelMessages = allMessages.join('\n\n');
const body = `
# Invalid Pull Request
diff --git a/message/label/needs-preview.md b/message/label/needs-preview.md
@@ -0,0 +1,2 @@
+### Needs Preview
+It is **mandatory** to provide a preview of your website in the form of an image or a link that is accessible over HTTP(S).+
\ No newline at end of file
diff --git a/package.json b/package.json
@@ -1,7 +1,7 @@
{
"name": "reviewbot",
"private": true,
- "version": "1.2.0",
+ "version": "1.2.1",
"type": "module",
"description": "An app to assist in the review process of is-a-dev",
"author": "iostpa",