From d7c8be638d6041cd2f4fa3cd158b9c27c5bd4cd5 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:00:46 -0400 Subject: [PATCH 01/32] ci: start work on autocloser --- .github/workflows/moderate-issue.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/moderate-issue.yml diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml new file mode 100644 index 0000000000..c8a16e9d16 --- /dev/null +++ b/.github/workflows/moderate-issue.yml @@ -0,0 +1,28 @@ +name: Moderate Issue +on: + issues: + types: + - opened + - edited + - reopened + issue_comment: + types: + - created +jobs: + moderate: + runs-on: ubuntu-latest + steps: + - name: Moderate issues + uses: tachiyomiorg/issue-moderator-action@v2 + if: startsWith( ${{ github.event.issue.body }} , "### Bug Description") + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + auto-close-rules: | + [ + { + "type": "body", + "regex": "### Log File\s+\[latest.log\]\(https:\/\/github.com\/${{ github.event.issue.repository.full_name }}\/files\/\d+\/latest.log\)", + "closeIfMatch": false, + "message": "@${issue.user.login} this issue was automatically closed because it did not follow the issue template" + } + ] From 6c33ed6fb2b74f0f5c68bb64dd8ec59e77074acf Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:03:35 -0400 Subject: [PATCH 02/32] idk --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index c8a16e9d16..28b0bd0647 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -21,7 +21,7 @@ jobs: [ { "type": "body", - "regex": "### Log File\s+\[latest.log\]\(https:\/\/github.com\/${{ github.event.issue.repository.full_name }}\/files\/\d+\/latest.log\)", + "regex": "### Log File[\n \t]+\[latest.log\]\(https:\/\/github.com\/${{ github.event.issue.repository.full_name }}\/files\/\d+\/latest.log\)", "closeIfMatch": false, "message": "@${issue.user.login} this issue was automatically closed because it did not follow the issue template" } From 366708d59f4e238451506f2c46c686d9529ca7a7 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:05:43 -0400 Subject: [PATCH 03/32] \ --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 28b0bd0647..c1e2936af5 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -21,7 +21,7 @@ jobs: [ { "type": "body", - "regex": "### Log File[\n \t]+\[latest.log\]\(https:\/\/github.com\/${{ github.event.issue.repository.full_name }}\/files\/\d+\/latest.log\)", + "regex": "### Log File[\\n \\t]+\\[latest.log\\]\\(https:\/\/github.com\/${{ github.event.issue.repository.full_name }}\/files\/\\d+\/latest.log\\)", "closeIfMatch": false, "message": "@${issue.user.login} this issue was automatically closed because it did not follow the issue template" } From 96d2a5ef58fc9b56c2c3fd284418bc853b694297 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:20:15 -0400 Subject: [PATCH 04/32] Replace github insert with loose regex --- .github/workflows/moderate-issue.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index c1e2936af5..33e3adf265 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -21,8 +21,9 @@ jobs: [ { "type": "body", - "regex": "### Log File[\\n \\t]+\\[latest.log\\]\\(https:\/\/github.com\/${{ github.event.issue.repository.full_name }}\/files\/\\d+\/latest.log\\)", + "regex": "### Log File[\\n \\t]+\\[latest.log\\]\\(https:\\/\\/github\\.com\\/\\w+\\/files\\/\\d+\\/latest.log\\)", "closeIfMatch": false, - "message": "@${issue.user.login} this issue was automatically closed because it did not follow the issue template" + "message": "@${issue.user.login} this issue was automatically closed because it did not follow the issue template", + "ignoreCase": true } ] From 690f31cb6e13f20d8d2f618be63fea56ece5ed82 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:25:42 -0400 Subject: [PATCH 05/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 33e3adf265..3d8dc07e4d 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -21,7 +21,7 @@ jobs: [ { "type": "body", - "regex": "### Log File[\\n \\t]+\\[latest.log\\]\\(https:\\/\\/github\\.com\\/\\w+\\/files\\/\\d+\\/latest.log\\)", + "regex": "### Log File\\s+\\[latest.log\\]\\(https:\/\/github/.com\/\\w+\/sodium-fabric\/files\/\\d+\/latest.log\\)", "closeIfMatch": false, "message": "@${issue.user.login} this issue was automatically closed because it did not follow the issue template", "ignoreCase": true From e05ffb1fb97d8973ab3675d1d1801af5762483fc Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:26:12 -0400 Subject: [PATCH 06/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 3d8dc07e4d..141e89b5ed 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -21,7 +21,7 @@ jobs: [ { "type": "body", - "regex": "### Log File\\s+\\[latest.log\\]\\(https:\/\/github/.com\/\\w+\/sodium-fabric\/files\/\\d+\/latest.log\\)", + "regex": "### Log File\\s+\\[latest.log\\]\\(https:\/\/github\\.com\/\\w+\/sodium-fabric\/files\/\\d+\/latest.log\\)", "closeIfMatch": false, "message": "@${issue.user.login} this issue was automatically closed because it did not follow the issue template", "ignoreCase": true From 722ab7432c77a1f3749664b5585a919fa5fad0d7 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:40:07 -0400 Subject: [PATCH 07/32] screw it, js --- .github/workflows/moderate-issue.yml | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 141e89b5ed..43bc0b6c81 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -3,27 +3,17 @@ on: issues: types: - opened - - edited - - reopened - issue_comment: - types: - - created jobs: moderate: runs-on: ubuntu-latest steps: - - name: Moderate issues - uses: tachiyomiorg/issue-moderator-action@v2 - if: startsWith( ${{ github.event.issue.body }} , "### Bug Description") + - uses: actions/github-script@v6 + id: match_script with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - auto-close-rules: | - [ - { - "type": "body", - "regex": "### Log File\\s+\\[latest.log\\]\\(https:\/\/github\\.com\/\\w+\/sodium-fabric\/files\/\\d+\/latest.log\\)", - "closeIfMatch": false, - "message": "@${issue.user.login} this issue was automatically closed because it did not follow the issue template", - "ignoreCase": true - } - ] + result-encoding: string + script: | + const LOG_FILE_REGEX = "### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)"; + + if (LOG_FILE_REGEX.test(context.issue().payload.body)) { + console.log("Log file found!") + } From db18a929ebe504ce24413497d33cf6fe0bae70cd Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:41:04 -0400 Subject: [PATCH 08/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 43bc0b6c81..714f015313 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -14,6 +14,6 @@ jobs: script: | const LOG_FILE_REGEX = "### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)"; - if (LOG_FILE_REGEX.test(context.issue().payload.body)) { + if (LOG_FILE_REGEX.test(context.issue.payload.body)) { console.log("Log file found!") } From 50903e87be697df94bc72cbb741dc970ad56bc60 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:43:42 -0400 Subject: [PATCH 09/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 714f015313..0bcdf923cc 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -3,6 +3,7 @@ on: issues: types: - opened + - reopened jobs: moderate: runs-on: ubuntu-latest @@ -14,6 +15,6 @@ jobs: script: | const LOG_FILE_REGEX = "### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)"; - if (LOG_FILE_REGEX.test(context.issue.payload.body)) { + if (LOG_FILE_REGEX.test(context.payload.issue.body)) { console.log("Log file found!") } From e053543fead3f2c2f5331b553975503d2b881ecf Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:45:15 -0400 Subject: [PATCH 10/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 0bcdf923cc..b1cdd846ef 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -13,7 +13,7 @@ jobs: with: result-encoding: string script: | - const LOG_FILE_REGEX = "### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)"; + const LOG_FILE_REGEX = new RegExp("### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)"); if (LOG_FILE_REGEX.test(context.payload.issue.body)) { console.log("Log file found!") From 483702e04ec4b513eca1ea561605b8d30597bff3 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:59:11 -0400 Subject: [PATCH 11/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index b1cdd846ef..35d9d409a6 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -14,7 +14,8 @@ jobs: result-encoding: string script: | const LOG_FILE_REGEX = new RegExp("### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)"); + console.log(context.issue.payload.body); if (LOG_FILE_REGEX.test(context.payload.issue.body)) { - console.log("Log file found!") + return "woo"; } From 062ea6d40e7ca136a2b67cca0ddce1b4270d2640 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:00:53 -0400 Subject: [PATCH 12/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 35d9d409a6..612cdca781 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -14,7 +14,7 @@ jobs: result-encoding: string script: | const LOG_FILE_REGEX = new RegExp("### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)"); - console.log(context.issue.payload.body); + console.log(context.payload.issue.body); if (LOG_FILE_REGEX.test(context.payload.issue.body)) { return "woo"; From f4460a2ff88c22e6d0cc0b32b53b589b53c3d84a Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:12:21 -0400 Subject: [PATCH 13/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 612cdca781..1c08d84599 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -13,9 +13,20 @@ jobs: with: result-encoding: string script: | - const LOG_FILE_REGEX = new RegExp("### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)"); - console.log(context.payload.issue.body); - - if (LOG_FILE_REGEX.test(context.payload.issue.body)) { - return "woo"; + const LOG_FILE_REGEX = /### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)/ + + if (!LOG_FILE_REGEX.test(a_str)) { + await github.rest.issues.get({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + state: "closed", + state_reason: "not_planned", + }) + await octokit.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Issue closed.", + }); } From bd66ec2e417a431d21e486d37dcdaffe8a360de6 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:13:24 -0400 Subject: [PATCH 14/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 1c08d84599..e10f4cb57d 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -15,7 +15,7 @@ jobs: script: | const LOG_FILE_REGEX = /### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)/ - if (!LOG_FILE_REGEX.test(a_str)) { + if (!LOG_FILE_REGEX.test(context.payload.issue.body)) { await github.rest.issues.get({ issue_number: context.issue.number, owner: context.repo.owner, From 97c1bdb3496c735b26a7aee5b2987674dff7cf17 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:15:13 -0400 Subject: [PATCH 15/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index e10f4cb57d..c504b13234 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -16,14 +16,14 @@ jobs: const LOG_FILE_REGEX = /### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)/ if (!LOG_FILE_REGEX.test(context.payload.issue.body)) { - await github.rest.issues.get({ + await github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, state: "closed", state_reason: "not_planned", }) - await octokit.rest.issues.createComment({ + await github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, From 82005f7bf7fc191738cd5b2aba0c2a2bad891611 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:26:50 -0400 Subject: [PATCH 16/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index c504b13234..4605bffb55 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -3,6 +3,7 @@ on: issues: types: - opened + - edited - reopened jobs: moderate: @@ -10,10 +11,12 @@ jobs: steps: - uses: actions/github-script@v6 id: match_script + if: startsWith( ${{ github.event.issue.body }} , "### Bug Description") with: result-encoding: string script: | - const LOG_FILE_REGEX = /### Log File[\n \t]+\[latest.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest.log\)/ + const LOG_FILE_REGEX = /### Log File\s+\[latest\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest\.log\)/ + const CRASH_REPORT_REGEX = /### Crash Report\s+\[crash.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/crash.+\.txt\)/ if (!LOG_FILE_REGEX.test(context.payload.issue.body)) { await github.rest.issues.update({ @@ -22,6 +25,7 @@ jobs: repo: context.repo.repo, state: "closed", state_reason: "not_planned", + labels: ["E-invalid"], }) await github.rest.issues.createComment({ issue_number: context.issue.number, @@ -29,4 +33,19 @@ jobs: repo: context.repo.repo, body: "Issue closed.", }); + } else if (!CRASH_REPORT_REGEX.test(context.payload.issue.body)) { + await github.rest.issues.update({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + state: "closed", + state_reason: "not_planned", + labels: ["E-invalid"], + }) + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Issue closed.", + }); } From 1addd99835f816bdb4857fe3e948b756198af448 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:31:56 -0400 Subject: [PATCH 17/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 4605bffb55..0152642a20 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -15,8 +15,13 @@ jobs: with: result-encoding: string script: | - const LOG_FILE_REGEX = /### Log File\s+\[latest\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest\.log\)/ - const CRASH_REPORT_REGEX = /### Crash Report\s+\[crash.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/crash.+\.txt\)/ + const issue_content = context.payload.issue.body; + const LOG_FILE_REGEX = /### Log File\s+\[latest\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest\.log\)/; + const CRASH_REPORT_REGEX = /### Crash Report\s+\[crash.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/crash.+\.txt\)/; + + if (!issue_content.startsWith("### Bug Description")) { + return; + } if (!LOG_FILE_REGEX.test(context.payload.issue.body)) { await github.rest.issues.update({ From 15a67d60f46b51a7d7f5fe4116e20f3392d6f45a Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:35:38 -0400 Subject: [PATCH 18/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 0152642a20..93f83b1aaa 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -16,14 +16,14 @@ jobs: result-encoding: string script: | const issue_content = context.payload.issue.body; - const LOG_FILE_REGEX = /### Log File\s+\[latest\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest\.log\)/; - const CRASH_REPORT_REGEX = /### Crash Report\s+\[crash.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/crash.+\.txt\)/; - - if (!issue_content.startsWith("### Bug Description")) { + if (context.payload.issue == "closed" || !issue_content.startsWith("### Bug Description")) { return; } + + const LOG_FILE_REGEX = /### Log File\s+\[latest\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest\.log\)/; + const CRASH_REPORT_REGEX = /### Crash Report\s+\[crash.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/crash.+\.txt\)/; - if (!LOG_FILE_REGEX.test(context.payload.issue.body)) { + if (!LOG_FILE_REGEX.test(issue_content)) { await github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, @@ -38,7 +38,7 @@ jobs: repo: context.repo.repo, body: "Issue closed.", }); - } else if (!CRASH_REPORT_REGEX.test(context.payload.issue.body)) { + } else if (!CRASH_REPORT_REGEX.test(issue_content)) { await github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, From b73ada2e77443a72bf426df906fdf1dcc8376acd Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:37:17 -0400 Subject: [PATCH 19/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 93f83b1aaa..616b7e67ff 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -16,7 +16,7 @@ jobs: result-encoding: string script: | const issue_content = context.payload.issue.body; - if (context.payload.issue == "closed" || !issue_content.startsWith("### Bug Description")) { + if (context.payload.issue.state == "closed" || !issue_content.startsWith("### Bug Description")) { return; } From 53402a3c728e621593dfe52c0eedb0d47d77c7e8 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:48:51 -0400 Subject: [PATCH 20/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 616b7e67ff..546a2f9a20 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -20,8 +20,8 @@ jobs: return; } - const LOG_FILE_REGEX = /### Log File\s+\[latest\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest\.log\)/; - const CRASH_REPORT_REGEX = /### Crash Report\s+\[crash.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/crash.+\.txt\)/; + const LOG_FILE_REGEX = /### Log File[^]+?\[latest\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest\.log\)/; + const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[crash.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/crash.+\.txt\)/; if (!LOG_FILE_REGEX.test(issue_content)) { await github.rest.issues.update({ From 367f31aed853ae9805e51bae9965f3ff52c0ee19 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:51:20 -0400 Subject: [PATCH 21/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 546a2f9a20..be78e9078b 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -20,8 +20,8 @@ jobs: return; } - const LOG_FILE_REGEX = /### Log File[^]+?\[latest\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/latest\.log\)/; - const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[crash.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/crash.+\.txt\)/; + const LOG_FILE_REGEX = /### Log File[^]+?\[.+\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.log\)/; + const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.txt\)/; if (!LOG_FILE_REGEX.test(issue_content)) { await github.rest.issues.update({ From ecd0a23690d3e26981cf94c31e96b2c9091ff3c6 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:02:30 -0400 Subject: [PATCH 22/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index be78e9078b..cd1618a4ae 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -16,12 +16,13 @@ jobs: result-encoding: string script: | const issue_content = context.payload.issue.body; - if (context.payload.issue.state == "closed" || !issue_content.startsWith("### Bug Description")) { + if (context.payload.issue.pull_request != null || context.payload.issue.state == "closed" || !issue_content.startsWith("### Bug Description")) { return; } - + + const author_name = context.payload.issue.user ? context.payload.issue.user.login : context.payload.sender.login; const LOG_FILE_REGEX = /### Log File[^]+?\[.+\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.log\)/; - const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[.+\.txt\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.txt\)/; + const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[.+\.(txt|log)\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.(txt|log)\)/; if (!LOG_FILE_REGEX.test(issue_content)) { await github.rest.issues.update({ @@ -36,7 +37,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: "Issue closed.", + body: `${author_name}, your issue was closed.", }); } else if (!CRASH_REPORT_REGEX.test(issue_content)) { await github.rest.issues.update({ @@ -51,6 +52,6 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: "Issue closed.", + body: `${author_name}, your issue was closed.", }); } From 3b5e706108be799572051a9d8a326dee508a6edb Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:03:45 -0400 Subject: [PATCH 23/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index cd1618a4ae..59834eb60d 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -37,7 +37,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${author_name}, your issue was closed.", + body: `${author_name}, your issue was closed.`, }); } else if (!CRASH_REPORT_REGEX.test(issue_content)) { await github.rest.issues.update({ @@ -52,6 +52,6 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${author_name}, your issue was closed.", + body: `${author_name}, your issue was closed.`, }); } From f3324887a10ff2ed4966ef7525a975434c13f84a Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:14:31 -0400 Subject: [PATCH 24/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 37 +++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 59834eb60d..a675a7ee4a 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -1,4 +1,4 @@ -name: Moderate Issue +name: Verify Issue on: issues: types: @@ -10,21 +10,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/github-script@v6 - id: match_script + id: verify-issue if: startsWith( ${{ github.event.issue.body }} , "### Bug Description") with: result-encoding: string script: | const issue_content = context.payload.issue.body; - if (context.payload.issue.pull_request != null || context.payload.issue.state == "closed" || !issue_content.startsWith("### Bug Description")) { - return; + if (context.payload.issue.pull_request != null || !issue_content.startsWith("### Bug Description")) { + return; } const author_name = context.payload.issue.user ? context.payload.issue.user.login : context.payload.sender.login; const LOG_FILE_REGEX = /### Log File[^]+?\[.+\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.log\)/; const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[.+\.(txt|log)\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.(txt|log)\)/; - if (!LOG_FILE_REGEX.test(issue_content)) { + if (context.payload.issue.state == "closed") { + if (!LOG_FILE_REGEX.test(issue_content)) { await github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, @@ -37,21 +38,35 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${author_name}, your issue was closed.`, + body: `@${author_name}, this issue was automatically closed because it did not follow the issue template. You either did not upload a log file or didn't upload it in the required format. Attach a log file and a crashlog as described in the issue template by dragging and dropping the file and letting GitHub create an attachment. Do not copy-paste the content of the log file into the area. Please edit your issue to add the required data and the issue will be automatically be reopened.`, }); - } else if (!CRASH_REPORT_REGEX.test(issue_content)) { + } else if (!CRASH_REPORT_REGEX.test(issue_content)) { await github.rest.issues.update({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + state: "closed", + state_reason: "not_planned", + labels: ["E-invalid"], + }) + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `@${author_name}, this issue was automatically closed because it did not follow the issue template. You either did not upload a crash log or didn't upload it in the required format. Attach a log file and a crash log as described in the issue template by dragging and dropping the file and letting GitHub create an attachment. Do not copy-paste the content of the log file into the area. Please edit your issue to add the required data and the issue will be automatically be reopened.`, + }); + } + } else if (context.payload.issue.labels.some(label => label.name == "E-invalid") && LOG_FILE_REGEX.test(issue_content) && CRASH_REPORT_REGEX.test(issue_content)) { + await github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - state: "closed", - state_reason: "not_planned", - labels: ["E-invalid"], + state: "open", }) await github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${author_name}, your issue was closed.`, + body: "Reopened because the issue now follows the issue template.", }); } From 067ed8e75b65fe45974346dccd38817b5482896e Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:18:09 -0400 Subject: [PATCH 25/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index a675a7ee4a..ae0cdb1f9e 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -20,6 +20,8 @@ jobs: return; } + console.log(context.payload.issue.labels); + const author_name = context.payload.issue.user ? context.payload.issue.user.login : context.payload.sender.login; const LOG_FILE_REGEX = /### Log File[^]+?\[.+\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.log\)/; const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[.+\.(txt|log)\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.(txt|log)\)/; From 333f44e16a1853c66094ed1732be596c183a3faf Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:21:12 -0400 Subject: [PATCH 26/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index ae0cdb1f9e..9b77af8207 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -20,13 +20,11 @@ jobs: return; } - console.log(context.payload.issue.labels); - const author_name = context.payload.issue.user ? context.payload.issue.user.login : context.payload.sender.login; const LOG_FILE_REGEX = /### Log File[^]+?\[.+\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.log\)/; const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[.+\.(txt|log)\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.(txt|log)\)/; - if (context.payload.issue.state == "closed") { + if (context.payload.issue.state == "open") { if (!LOG_FILE_REGEX.test(issue_content)) { await github.rest.issues.update({ issue_number: context.issue.number, From db1c32fa61e10948111780d26faa8c7f65720dc5 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:23:30 -0400 Subject: [PATCH 27/32] Update moderate-issue.yml --- .github/workflows/moderate-issue.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/moderate-issue.yml index 9b77af8207..fbd73bb3ae 100644 --- a/.github/workflows/moderate-issue.yml +++ b/.github/workflows/moderate-issue.yml @@ -11,20 +11,20 @@ jobs: steps: - uses: actions/github-script@v6 id: verify-issue - if: startsWith( ${{ github.event.issue.body }} , "### Bug Description") with: result-encoding: string script: | - const issue_content = context.payload.issue.body; - if (context.payload.issue.pull_request != null || !issue_content.startsWith("### Bug Description")) { + const issue_payload = context.payload.issue; + const issue_content = issue_payload.body; + if (issue_payload.pull_request != null || !issue_content.startsWith("### Bug Description")) { return; } - const author_name = context.payload.issue.user ? context.payload.issue.user.login : context.payload.sender.login; + const author_name = issue_payload.user ? issue_payload.user.login : context.payload.sender.login; const LOG_FILE_REGEX = /### Log File[^]+?\[.+\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.log\)/; const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[.+\.(txt|log)\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.(txt|log)\)/; - if (context.payload.issue.state == "open") { + if (issue_payload.state == "open") { if (!LOG_FILE_REGEX.test(issue_content)) { await github.rest.issues.update({ issue_number: context.issue.number, @@ -56,7 +56,7 @@ jobs: body: `@${author_name}, this issue was automatically closed because it did not follow the issue template. You either did not upload a crash log or didn't upload it in the required format. Attach a log file and a crash log as described in the issue template by dragging and dropping the file and letting GitHub create an attachment. Do not copy-paste the content of the log file into the area. Please edit your issue to add the required data and the issue will be automatically be reopened.`, }); } - } else if (context.payload.issue.labels.some(label => label.name == "E-invalid") && LOG_FILE_REGEX.test(issue_content) && CRASH_REPORT_REGEX.test(issue_content)) { + } else if (issue_payload.labels.some(label => label.name == "E-invalid") && LOG_FILE_REGEX.test(issue_content) && CRASH_REPORT_REGEX.test(issue_content)) { await github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, From 6b415b8c59dd001f620cae091a8a08a79ec65306 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:26:40 -0400 Subject: [PATCH 28/32] Rename moderate-issue.yml to verify-issue.yml --- .github/workflows/{moderate-issue.yml => verify-issue.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{moderate-issue.yml => verify-issue.yml} (100%) diff --git a/.github/workflows/moderate-issue.yml b/.github/workflows/verify-issue.yml similarity index 100% rename from .github/workflows/moderate-issue.yml rename to .github/workflows/verify-issue.yml From 19e223c957e9a6779bda8489eb2896694dcee8ee Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 16:41:39 -0400 Subject: [PATCH 29/32] Update verify-issue.yml --- .github/workflows/verify-issue.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/verify-issue.yml b/.github/workflows/verify-issue.yml index fbd73bb3ae..4b623cfe2d 100644 --- a/.github/workflows/verify-issue.yml +++ b/.github/workflows/verify-issue.yml @@ -19,13 +19,14 @@ jobs: if (issue_payload.pull_request != null || !issue_content.startsWith("### Bug Description")) { return; } - + const author_name = issue_payload.user ? issue_payload.user.login : context.payload.sender.login; - const LOG_FILE_REGEX = /### Log File[^]+?\[.+\.log\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.log\)/; + const LOG_FILE_REGEX = /### Log File[^]+?\[.+\.(txt|log)\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.(txt|log)\)/; const CRASH_REPORT_REGEX = /### Crash Report[^]+?\[.+\.(txt|log)\]\(https:\/\/github\.com\/\w+\/sodium-fabric\/files\/\d+\/.+\.(txt|log)\)/; - + if (issue_payload.state == "open") { - if (!LOG_FILE_REGEX.test(issue_content)) { + let match = LOG_FILE_REGEX.exec(issue_content); + if (!match || !match[0].includes("### Crash Report")) { await github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, From 2e58c852a43ae69c469ccdccc16424ee0e0be15e Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 16:44:17 -0400 Subject: [PATCH 30/32] Update verify-issue.yml --- .github/workflows/verify-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify-issue.yml b/.github/workflows/verify-issue.yml index 4b623cfe2d..cb9e5bffcc 100644 --- a/.github/workflows/verify-issue.yml +++ b/.github/workflows/verify-issue.yml @@ -26,7 +26,7 @@ jobs: if (issue_payload.state == "open") { let match = LOG_FILE_REGEX.exec(issue_content); - if (!match || !match[0].includes("### Crash Report")) { + if (!match || match[0].includes("### Crash Report")) { await github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, From 01125e15db05c56a2da6b5054e9a61b88db8ece1 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 20:19:30 -0400 Subject: [PATCH 31/32] Update verify-issue.yml --- .github/workflows/verify-issue.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/verify-issue.yml b/.github/workflows/verify-issue.yml index cb9e5bffcc..462d91032f 100644 --- a/.github/workflows/verify-issue.yml +++ b/.github/workflows/verify-issue.yml @@ -63,6 +63,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, state: "open", + labels: ["S-needs-triage"], }) await github.rest.issues.createComment({ issue_number: context.issue.number, From 9d5496e24abd9a7cff79b3602899fb5f6db983b4 Mon Sep 17 00:00:00 2001 From: Astrea <25420078+AstreaTSS@users.noreply.github.com> Date: Sat, 12 Aug 2023 21:58:25 -0400 Subject: [PATCH 32/32] Add notes about the need to use attachments for logs --- .github/ISSUE_TEMPLATE/bug_report.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index c4ccd74eb3..66c9119914 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -49,6 +49,10 @@ body: label: Log File description: >- Attach the most recent log file from your client (`logs/latest.log`). This file should always be present. + + **Important:** Upload the file to this issue as an attachment by first selecting the text box below and then dragging your file onto it. + GitHub will upload the file as an attachment and generate a link to it. This issue will be automatically closed if you omit a log + file or copy-paste its content here. placeholder: >- Upload the log file here... validations: @@ -58,7 +62,7 @@ body: attributes: label: Crash Report description: >- - Attach the most recent crash report from the `crash-reports` folder. This is different from the log file above, and it contains + Attach the most recent crash report from the `crash-reports` folder in the same manner as before. This is different from the log file above, and it contains important information about your hardware and software configuration. **Important:** If your game is not crashing as a result of your problem, then you need to obtain a crash report manually. This can be done