From c39b5eaff79c56bfecf2cd285a03aab8a84bb900 Mon Sep 17 00:00:00 2001 From: LIGMATV Date: Thu, 2 Jan 2025 10:04:39 +0700 Subject: [PATCH 01/51] Update 2.json --- domains/2.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/domains/2.json b/domains/2.json index d6fc683e0..5e6f21eae 100644 --- a/domains/2.json +++ b/domains/2.json @@ -1,11 +1,10 @@ { "description": "LIGMATV's URL Manager (aka 2)", - "repo": "https://github.com/LIGMATV/links", "owner": { "username": "LIGMATV", "email": "ligmatv.id@gmail.com" }, "record": { - "CNAME": "ligmatv.github.io" + "CNAME": "ligmatv-links.vercel.app" } } From dce19c87de7e0186319fd79770f4212536c489e9 Mon Sep 17 00:00:00 2001 From: LIGMATV Date: Thu, 2 Jan 2025 10:12:46 +0700 Subject: [PATCH 02/51] Create _vercel.2.json --- domains/_vercel.2.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 domains/_vercel.2.json diff --git a/domains/_vercel.2.json b/domains/_vercel.2.json new file mode 100644 index 000000000..24db2720e --- /dev/null +++ b/domains/_vercel.2.json @@ -0,0 +1,10 @@ +{ + "description": "LIGMATV's URL Manager (aka 2)", + "owner": { + "username": "LIGMATV", + "email": "ligmatv.id@gmail.com" + }, + "record": { + "TXT": ["vc-domain-verify=2.is-a.dev,ea014a1b9a6ec8986aa0"] + } +} From 6f84fc787b15ec1cf0b8dc7788eaffc543215cb6 Mon Sep 17 00:00:00 2001 From: Amiitesh TSP Date: Thu, 2 Jan 2025 13:12:32 +0530 Subject: [PATCH 03/51] Create hash-cracker.json --- domains/hash-cracker.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 domains/hash-cracker.json diff --git a/domains/hash-cracker.json b/domains/hash-cracker.json new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/domains/hash-cracker.json @@ -0,0 +1 @@ + From 4bf905878415b3df047261efe7052bc04bb86138 Mon Sep 17 00:00:00 2001 From: Amiitesh TSP Date: Thu, 2 Jan 2025 13:18:11 +0530 Subject: [PATCH 04/51] Create Hash-Cracker.json --- domains/Hash-Cracker.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 domains/Hash-Cracker.json diff --git a/domains/Hash-Cracker.json b/domains/Hash-Cracker.json new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/domains/Hash-Cracker.json @@ -0,0 +1 @@ + From afa54538db2954b3740a848e92b0c8dceaa814b1 Mon Sep 17 00:00:00 2001 From: Amiitesh TSP Date: Thu, 2 Jan 2025 13:21:12 +0530 Subject: [PATCH 05/51] Delete domains/Hash-Cracker.json --- domains/Hash-Cracker.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 domains/Hash-Cracker.json diff --git a/domains/Hash-Cracker.json b/domains/Hash-Cracker.json deleted file mode 100644 index 8b1378917..000000000 --- a/domains/Hash-Cracker.json +++ /dev/null @@ -1 +0,0 @@ - From 464ebb2db511978aa136ed82da03cb56c3082526 Mon Sep 17 00:00:00 2001 From: Amiitesh TSP Date: Thu, 2 Jan 2025 13:23:19 +0530 Subject: [PATCH 06/51] Create Hash-Cracker.json --- domains/Hash-Cracker.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 domains/Hash-Cracker.json diff --git a/domains/Hash-Cracker.json b/domains/Hash-Cracker.json new file mode 100644 index 000000000..489333b0e --- /dev/null +++ b/domains/Hash-Cracker.json @@ -0,0 +1,8 @@ +{ + "owner": { + "username": "Hash-Cracker" + }, + "record": { + "CNAME": "Hash-Cracker.github.io" + } +} From 7c390e0dd8bd5acc2b2951a5e75dd05f0d668a88 Mon Sep 17 00:00:00 2001 From: WinStuff <104269577+enderfoxbg@users.noreply.github.com> Date: Thu, 2 Jan 2025 10:57:46 +0200 Subject: [PATCH 07/51] Create _discord.justwinstuff.json --- domains/_discord.justwinstuff.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 domains/_discord.justwinstuff.json diff --git a/domains/_discord.justwinstuff.json b/domains/_discord.justwinstuff.json new file mode 100644 index 000000000..f846fd946 --- /dev/null +++ b/domains/_discord.justwinstuff.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "enderfoxbg", + "discord": "970380468090437672" + }, + "record": { + "TXT": ["dh=75e9bdc423ca4351bb8938087b552bc2ee9a3e16"] + } +} From 93f0ea28be8be86e9ee9db88667beaf89a21eb28 Mon Sep 17 00:00:00 2001 From: shockbs <77534483+shockbs@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:04:55 +0800 Subject: [PATCH 08/51] Delete domains/face-recognition.shockbs.json --- domains/face-recognition.shockbs.json | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 domains/face-recognition.shockbs.json diff --git a/domains/face-recognition.shockbs.json b/domains/face-recognition.shockbs.json deleted file mode 100644 index 6000dc098..000000000 --- a/domains/face-recognition.shockbs.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "shockbs", - "email": "apipherng@gmail.com" - }, - "record": { - "CNAME": "na-west1.surge.sh" - } -} From 493a47913856fac573370e3efb92f5789e6a0ec8 Mon Sep 17 00:00:00 2001 From: Amiitesh TSP Date: Thu, 2 Jan 2025 15:40:56 +0530 Subject: [PATCH 09/51] Delete domains/Hash-Cracker.json --- domains/Hash-Cracker.json | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 domains/Hash-Cracker.json diff --git a/domains/Hash-Cracker.json b/domains/Hash-Cracker.json deleted file mode 100644 index 489333b0e..000000000 --- a/domains/Hash-Cracker.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "owner": { - "username": "Hash-Cracker" - }, - "record": { - "CNAME": "Hash-Cracker.github.io" - } -} From 9bbf70b9466cf2c5cc587db4e34b3a45c8cb02f2 Mon Sep 17 00:00:00 2001 From: Amiitesh TSP Date: Thu, 2 Jan 2025 15:43:33 +0530 Subject: [PATCH 10/51] Update hash-cracker.json --- domains/hash-cracker.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/domains/hash-cracker.json b/domains/hash-cracker.json index 8b1378917..489333b0e 100644 --- a/domains/hash-cracker.json +++ b/domains/hash-cracker.json @@ -1 +1,8 @@ - +{ + "owner": { + "username": "Hash-Cracker" + }, + "record": { + "CNAME": "Hash-Cracker.github.io" + } +} From f7e410c0cfa6225caa01fc79b19caa48fa30a5ff Mon Sep 17 00:00:00 2001 From: Amiitesh TSP Date: Thu, 2 Jan 2025 15:48:14 +0530 Subject: [PATCH 11/51] Update hash-cracker.json --- domains/hash-cracker.json | 1 + 1 file changed, 1 insertion(+) diff --git a/domains/hash-cracker.json b/domains/hash-cracker.json index 489333b0e..932ddd189 100644 --- a/domains/hash-cracker.json +++ b/domains/hash-cracker.json @@ -1,6 +1,7 @@ { "owner": { "username": "Hash-Cracker" + "email": "tspamiitesh@gmail.com" }, "record": { "CNAME": "Hash-Cracker.github.io" From 82c124038a41a9e0eff233f8de538805eb28a1aa Mon Sep 17 00:00:00 2001 From: Amiitesh TSP Date: Thu, 2 Jan 2025 15:52:32 +0530 Subject: [PATCH 12/51] Update hash-cracker.json --- domains/hash-cracker.json | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/domains/hash-cracker.json b/domains/hash-cracker.json index 932ddd189..576894dc0 100644 --- a/domains/hash-cracker.json +++ b/domains/hash-cracker.json @@ -1,9 +1,11 @@ { - "owner": { - "username": "Hash-Cracker" - "email": "tspamiitesh@gmail.com" - }, - "record": { - "CNAME": "Hash-Cracker.github.io" - } -} + "description": "A portfolio website", + "repo": "https://github.com/hash-cracker/hash-cracker.github.io", + "owner": { + "username": "hash-cracker", + "email": "tspamiitesh@gmail.com", + }, + "record": { + "CNAME": "hash-cracker.github.io" + } +} From d795c1c873a4426162213b22bd896c079d2164d1 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:46:14 +0800 Subject: [PATCH 13/51] add basic pr tests --- .github/workflows/validation.yml | 9 +++++++++ tests/pr.test.js | 23 +++++++++++++++++++++++ util/administrators.json | 4 ++++ util/reserved-domains.json | 4 +++- 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/pr.test.js create mode 100644 util/administrators.json diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index d48c9a347..c5dd5964a 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -36,6 +36,15 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Get Modified JSON Files + id: modified_files + run: | + MODIFIED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^domains/.*\.json$' | sed 's|.*/||' | tr '\n' ',' | sed 's|,$||') + echo "MODIFIED_FILES=${MODIFIED_FILES}" >> $GITHUB_ENV + - run: npm install - run: npm test + env: + PULL_REQUEST: ${{ github.event.pull_request.number || false }} # false if not a PR + MODIFIED_FILES: ${{ env.MODIFIED_FILES }} diff --git a/tests/pr.test.js b/tests/pr.test.js new file mode 100644 index 000000000..6e5588fd7 --- /dev/null +++ b/tests/pr.test.js @@ -0,0 +1,23 @@ +if (!process.env.PULL_REQUEST) return; + +const t = require("ava"); +const fs = require("fs-extra"); +const path = require("path"); + +const PR_AUTHOR = process.env.PR_AUTHOR; +const MODIFIED_FILES = process.env.MODIFIED_FILES.split(","); + +const domainsPath = path.resolve("domains"); + +const admins = require("../util/administrators.json"); + +t("Modified JSON files must be owned by the PR author", (t) => { + MODIFIED_FILES.forEach((file) => { + const domain = fs.readJsonSync(path.join(domainsPath, file)); + + t.true( + domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), + `${file}: Owner should be ${PR_AUTHOR} but is ${domain.owner}` + ); + }); +}); diff --git a/util/administrators.json b/util/administrators.json new file mode 100644 index 000000000..f85832ced --- /dev/null +++ b/util/administrators.json @@ -0,0 +1,4 @@ +[ + "wdhdev", + "DEV-DIBSTER" +] \ No newline at end of file diff --git a/util/reserved-domains.json b/util/reserved-domains.json index 67087b209..42a683c8c 100644 --- a/util/reserved-domains.json +++ b/util/reserved-domains.json @@ -8,7 +8,9 @@ "api", "auth", "authentication", + "authorisation", "authorise", + "authorization", "authorize", "aux", "billing", @@ -17,6 +19,7 @@ "cart", "catalog", "checkout", + "co", "com", "com[1-9]", "con", @@ -74,7 +77,6 @@ "payments", "portal", "postmaster", - "prn", "recovery", "redirect", "registrar", From b7739fb0c843cb79e878f26e64d1aaf828b10f96 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:48:03 +0800 Subject: [PATCH 14/51] Update validation.yml --- .github/workflows/validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index c5dd5964a..259be4388 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -46,5 +46,5 @@ jobs: - run: npm test env: - PULL_REQUEST: ${{ github.event.pull_request.number || false }} # false if not a PR + PULL_REQUEST: ${{ github.event_name == 'pull_request' }} MODIFIED_FILES: ${{ env.MODIFIED_FILES }} From f78a7beddc96b8384dd25a2e0db5dbae2cbb9e96 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:54:05 +0800 Subject: [PATCH 15/51] updates --- .github/workflows/stale.yml | 31 +++++++++++++++---------------- .github/workflows/validation.yml | 9 ++------- tests/pr.test.js | 9 ++++++--- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 9eefecd7b..ad78c7b61 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,21 +1,20 @@ name: StaleBOT on: - workflow_dispatch: - name: 'Force cleanup' - schedule: - - cron: "30 14 * * *" + workflow_dispatch: + schedule: + - cron: "30 14 * * *" jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-stale: 7 - days-before-close: 3 - stale-issue-message: 'This issue has been marked as stale due to inactivity and will be closed. Comment anything on this issue to prevent it' - stale-pr-message: 'This pull request has been marked as stale due to inactivity and will be closed. Comment anything on this PR to prevent it' - exempt-issue-labels: 'no-stale' - exempt-pr-labels: 'no-stale' + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 7 + days-before-close: 3 + stale-issue-message: "This issue has been marked as stale due to inactivity and will be closed. Comment anything on this issue to prevent it" + stale-pr-message: "This pull request has been marked as stale due to inactivity and will be closed. Comment anything on this PR to prevent it" + exempt-issue-labels: "no-stale" + exempt-pr-labels: "no-stale" diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 259be4388..0a11830df 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -36,15 +36,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Get Modified JSON Files - id: modified_files - run: | - MODIFIED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^domains/.*\.json$' | sed 's|.*/||' | tr '\n' ',' | sed 's|,$||') - echo "MODIFIED_FILES=${MODIFIED_FILES}" >> $GITHUB_ENV - - run: npm install - run: npm test env: - PULL_REQUEST: ${{ github.event_name == 'pull_request' }} + EVENT: ${{ github.event_name }} + PR_AUTHOR: ${{ github.event.pull_request.user.login }} MODIFIED_FILES: ${{ env.MODIFIED_FILES }} diff --git a/tests/pr.test.js b/tests/pr.test.js index 6e5588fd7..98a153a7d 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -1,5 +1,3 @@ -if (!process.env.PULL_REQUEST) return; - const t = require("ava"); const fs = require("fs-extra"); const path = require("path"); @@ -12,12 +10,17 @@ const domainsPath = path.resolve("domains"); const admins = require("../util/administrators.json"); t("Modified JSON files must be owned by the PR author", (t) => { + if(process.env.EVENT !== "pull_request") { + t.pass(); + return; + } + MODIFIED_FILES.forEach((file) => { const domain = fs.readJsonSync(path.join(domainsPath, file)); t.true( domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), - `${file}: Owner should be ${PR_AUTHOR} but is ${domain.owner}` + `${file}: Owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` ); }); }); From 79487832232ae80939327db1d558ceb2d169ce34 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:56:36 +0800 Subject: [PATCH 16/51] Update validation.yml --- .github/workflows/validation.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 0a11830df..3b9476f0e 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -38,8 +38,14 @@ jobs: - run: npm install + - name: Get modified files + if: github.event_name == 'pull_request' + id: files + run: | + echo "::set-output name=files::$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})" + - run: npm test env: EVENT: ${{ github.event_name }} PR_AUTHOR: ${{ github.event.pull_request.user.login }} - MODIFIED_FILES: ${{ env.MODIFIED_FILES }} + MODIFIED_FILES: ${{ steps.files.outputs.files || '' }} From 70ae9ef6d93af16207486542c026fe6ea9cd3a4f Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:59:42 +0800 Subject: [PATCH 17/51] Update pr.test.js --- tests/pr.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pr.test.js b/tests/pr.test.js index 98a153a7d..b29d1bc1a 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -16,6 +16,7 @@ t("Modified JSON files must be owned by the PR author", (t) => { } MODIFIED_FILES.forEach((file) => { + console.log(file) const domain = fs.readJsonSync(path.join(domainsPath, file)); t.true( From 7b6c8d8580e26ada483f0a6acb802c353f285b76 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:02:36 +0800 Subject: [PATCH 18/51] Update validation.yml --- .github/workflows/validation.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 3b9476f0e..94a4f08f6 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -41,11 +41,10 @@ jobs: - name: Get modified files if: github.event_name == 'pull_request' id: files - run: | - echo "::set-output name=files::$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})" + run: echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT - run: npm test env: EVENT: ${{ github.event_name }} PR_AUTHOR: ${{ github.event.pull_request.user.login }} - MODIFIED_FILES: ${{ steps.files.outputs.files || '' }} + MODIFIED_FILES: ${{ steps.files.outputs.changed_files || '' }} From 2ca826b7ab94de59f49ac72825f5a80ad83bc410 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:04:43 +0800 Subject: [PATCH 19/51] Update validation.yml --- .github/workflows/validation.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 94a4f08f6..3b6192875 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -41,7 +41,9 @@ jobs: - name: Get modified files if: github.event_name == 'pull_request' id: files - run: echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT + run: | + echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT + echo $changed_files - run: npm test env: From 8fde5c76ae0520ff8a2132e22b37f77e9d47f351 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:06:16 +0800 Subject: [PATCH 20/51] Update validation.yml --- .github/workflows/validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 3b6192875..3b8b3e9f8 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -42,7 +42,7 @@ jobs: if: github.event_name == 'pull_request' id: files run: | - echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT + echo "changed_files=$(git diff --name-only HEAD~1 HEAD | xargs)" >> $GITHUB_OUTPUT echo $changed_files - run: npm test From 8be1788c63f207a14cddbf693d805e60f6e34ede Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:13:10 +0800 Subject: [PATCH 21/51] fixes? --- .github/workflows/validation.yml | 11 +++++++++-- tests/pr.test.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 3b8b3e9f8..a23aa0890 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -39,14 +39,21 @@ jobs: - run: npm install - name: Get modified files - if: github.event_name == 'pull_request' + id: files run: | echo "changed_files=$(git diff --name-only HEAD~1 HEAD | xargs)" >> $GITHUB_OUTPUT echo $changed_files + - name: Get all modified domain JSON files + if: github.event_name == 'pull_request' + id: changed-files + uses: tj-actions/changed-files@v45 + with: + files: domains/*.json + - run: npm test env: EVENT: ${{ github.event_name }} PR_AUTHOR: ${{ github.event.pull_request.user.login }} - MODIFIED_FILES: ${{ steps.files.outputs.changed_files || '' }} + MODIFIED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/tests/pr.test.js b/tests/pr.test.js index b29d1bc1a..e588a2ba1 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -3,7 +3,7 @@ const fs = require("fs-extra"); const path = require("path"); const PR_AUTHOR = process.env.PR_AUTHOR; -const MODIFIED_FILES = process.env.MODIFIED_FILES.split(","); +const MODIFIED_FILES = process.env.MODIFIED_FILES.split("\n"); const domainsPath = path.resolve("domains"); From 2b7e741a09a11e0de9f1f9e4f9d636a1775cac09 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:16:05 +0800 Subject: [PATCH 22/51] bug fix --- .github/workflows/validation.yml | 7 ------- tests/pr.test.js | 6 +++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index a23aa0890..a22cd67a6 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -38,13 +38,6 @@ jobs: - run: npm install - - name: Get modified files - - id: files - run: | - echo "changed_files=$(git diff --name-only HEAD~1 HEAD | xargs)" >> $GITHUB_OUTPUT - echo $changed_files - - name: Get all modified domain JSON files if: github.event_name == 'pull_request' id: changed-files diff --git a/tests/pr.test.js b/tests/pr.test.js index e588a2ba1..1fe526d75 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -3,7 +3,11 @@ const fs = require("fs-extra"); const path = require("path"); const PR_AUTHOR = process.env.PR_AUTHOR; -const MODIFIED_FILES = process.env.MODIFIED_FILES.split("\n"); +let MODIFIED_FILES = process.env.MODIFIED_FILES.split(" "); + +for (let i = 0; i < MODIFIED_FILES.length; i++) { + MODIFIED_FILES[i] = MODIFIED_FILES[i].substring(MODIFIED_FILES[i].lastIndexOf("/") + 1); +} const domainsPath = path.resolve("domains"); From b560cf35ca11df1f6d5ac9465b3da519eea24463 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:22:57 +0800 Subject: [PATCH 23/51] test --- .github/workflows/validation.yml | 9 +++++++++ tests/pr.test.js | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index a22cd67a6..4f9863fc7 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -45,6 +45,15 @@ jobs: with: files: domains/*.json + - name: testing + run: | + ls + ls ../ + echo ${{ steps.changed-files.outputs.all_changed_files }} + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + cat $file + done + - run: npm test env: EVENT: ${{ github.event_name }} diff --git a/tests/pr.test.js b/tests/pr.test.js index 1fe526d75..5de425a0f 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -20,7 +20,6 @@ t("Modified JSON files must be owned by the PR author", (t) => { } MODIFIED_FILES.forEach((file) => { - console.log(file) const domain = fs.readJsonSync(path.join(domainsPath, file)); t.true( From 51867e7928be720e5b9cb2f529685583c0b1e5c1 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:33:10 +0800 Subject: [PATCH 24/51] more pr tests --- .github/workflows/validation.yml | 16 +++++++--------- tests/pr.test.js | 31 +++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 4f9863fc7..92a03e6bb 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -35,6 +35,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + path: ${{ github.run_id }} + + - uses: actions/checkout@v4 + with: + repository: is-a-dev/register + path: register - run: npm install @@ -45,15 +52,6 @@ jobs: with: files: domains/*.json - - name: testing - run: | - ls - ls ../ - echo ${{ steps.changed-files.outputs.all_changed_files }} - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - cat $file - done - - run: npm test env: EVENT: ${{ github.event_name }} diff --git a/tests/pr.test.js b/tests/pr.test.js index 5de425a0f..ccd3015f0 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -10,6 +10,7 @@ for (let i = 0; i < MODIFIED_FILES.length; i++) { } const domainsPath = path.resolve("domains"); +const headDomainsPath = path.resolve("../register/domains"); const admins = require("../util/administrators.json"); @@ -20,11 +21,37 @@ t("Modified JSON files must be owned by the PR author", (t) => { } MODIFIED_FILES.forEach((file) => { + const modifiedDomain = fs.readJsonSync(path.join(domainsPath, file)); + let currentDomain = null; + + try { + currentDomain = fs.readJsonSync(path.join(headDomainsPath, file)); + } catch { + currentDomain = modifiedDomain; + } + + t.true( + currentDomain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), + `${file}: Domain owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` + ); + }); +}); + + +t("New JSON files must be owned by the PR author", (t) => { + if(process.env.EVENT !== "pull_request") { + t.pass(); + return; + } + + const newFiles = fs.readdirSync(domainsPath).filter((file) => !fs.readdirSync(headDomainsPath).includes(file)); + + newFiles.forEach((file) => { const domain = fs.readJsonSync(path.join(domainsPath, file)); t.true( domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), - `${file}: Owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` + `${file}: Domain owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` ); }); -}); +}) From 1e53e46efc64a72706ed969e61eae27e24c1a736 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:35:27 +0800 Subject: [PATCH 25/51] Update validation.yml --- .github/workflows/validation.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 92a03e6bb..10c7c4aa5 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -41,7 +41,9 @@ jobs: - uses: actions/checkout@v4 with: repository: is-a-dev/register - path: register + path: ../register + + - run: cd ${{ github.run_id }} - run: npm install From 67e6b7b0ac8d045335d4c450d7e08fb3afc83122 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:37:35 +0800 Subject: [PATCH 26/51] Update validation.yml --- .github/workflows/validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 10c7c4aa5..0b6dd409f 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -43,7 +43,7 @@ jobs: repository: is-a-dev/register path: ../register - - run: cd ${{ github.run_id }} + - run: ls - run: npm install From 6993488eb28e531c88fb795d55c537b1d5d433d8 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:41:05 +0800 Subject: [PATCH 27/51] fixes --- .github/workflows/validation.yml | 6 +++++- tests/pr.test.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 0b6dd409f..aaa0bab1a 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -44,6 +44,7 @@ jobs: path: ../register - run: ls + - run: ls ../ - run: npm install @@ -54,8 +55,11 @@ jobs: with: files: domains/*.json - - run: npm test + - run: cd .. + + - run: npx ava register/tests/*.test.js env: EVENT: ${{ github.event_name }} + RUN_ID: ${{ github.run_id }} PR_AUTHOR: ${{ github.event.pull_request.user.login }} MODIFIED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/tests/pr.test.js b/tests/pr.test.js index ccd3015f0..9244460ff 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -9,8 +9,8 @@ for (let i = 0; i < MODIFIED_FILES.length; i++) { MODIFIED_FILES[i] = MODIFIED_FILES[i].substring(MODIFIED_FILES[i].lastIndexOf("/") + 1); } -const domainsPath = path.resolve("domains"); -const headDomainsPath = path.resolve("../register/domains"); +const domainsPath = path.resolve(`${process.env.RUN_ID}/domains`); +const headDomainsPath = path.resolve("register/domains"); const admins = require("../util/administrators.json"); From ebe879e492e9003d09b70be40cd6fa595ff5a17b Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:44:24 +0800 Subject: [PATCH 28/51] Update validation.yml --- .github/workflows/validation.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index aaa0bab1a..9f17e9dae 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -43,8 +43,10 @@ jobs: repository: is-a-dev/register path: ../register - - run: ls - - run: ls ../ + - run: | + ls + ls ../ + ls ../ - run: npm install From 2f31cd774869920122aa7d58ef5dca15243bb77c Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:49:51 +0800 Subject: [PATCH 29/51] fix stuff --- .github/workflows/validation.yml | 14 +++----------- tests/pr.test.js | 4 ++-- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 9f17e9dae..f77187016 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -35,18 +35,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - path: ${{ github.run_id }} - uses: actions/checkout@v4 with: repository: is-a-dev/register - path: ../register - - - run: | - ls - ls ../ - ls ../ + path: register-${{ github.run_id }} - run: npm install @@ -57,9 +50,8 @@ jobs: with: files: domains/*.json - - run: cd .. - - - run: npx ava register/tests/*.test.js + - name: Run tests + run: npx ava tests/*.test.js env: EVENT: ${{ github.event_name }} RUN_ID: ${{ github.run_id }} diff --git a/tests/pr.test.js b/tests/pr.test.js index 9244460ff..f178ddecd 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -9,8 +9,8 @@ for (let i = 0; i < MODIFIED_FILES.length; i++) { MODIFIED_FILES[i] = MODIFIED_FILES[i].substring(MODIFIED_FILES[i].lastIndexOf("/") + 1); } -const domainsPath = path.resolve(`${process.env.RUN_ID}/domains`); -const headDomainsPath = path.resolve("register/domains"); +const domainsPath = path.resolve("domains"); +const headDomainsPath = path.resolve(`register-${process.env.RUN_ID}/domains`); const admins = require("../util/administrators.json"); From ec4e7b5676454c61ac53c2ea51bafea99cc4be16 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:53:15 +0800 Subject: [PATCH 30/51] maybe this will fix it --- tests/pr.test.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index f178ddecd..8a6ac0ebd 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -3,11 +3,7 @@ const fs = require("fs-extra"); const path = require("path"); const PR_AUTHOR = process.env.PR_AUTHOR; -let MODIFIED_FILES = process.env.MODIFIED_FILES.split(" "); - -for (let i = 0; i < MODIFIED_FILES.length; i++) { - MODIFIED_FILES[i] = MODIFIED_FILES[i].substring(MODIFIED_FILES[i].lastIndexOf("/") + 1); -} +const MODIFIED_FILES = process.env.MODIFIED_FILES.split(" "); const domainsPath = path.resolve("domains"); const headDomainsPath = path.resolve(`register-${process.env.RUN_ID}/domains`); @@ -21,11 +17,11 @@ t("Modified JSON files must be owned by the PR author", (t) => { } MODIFIED_FILES.forEach((file) => { - const modifiedDomain = fs.readJsonSync(path.join(domainsPath, file)); + const modifiedDomain = fs.readJsonSync(path.join(domainsPath, file.substring(MODIFIED_FILES[i].lastIndexOf("/") + 1))); let currentDomain = null; try { - currentDomain = fs.readJsonSync(path.join(headDomainsPath, file)); + currentDomain = fs.readJsonSync(path.join(headDomainsPath, file.substring(MODIFIED_FILES[i].lastIndexOf("/") + 1))); } catch { currentDomain = modifiedDomain; } @@ -44,10 +40,10 @@ t("New JSON files must be owned by the PR author", (t) => { return; } - const newFiles = fs.readdirSync(domainsPath).filter((file) => !fs.readdirSync(headDomainsPath).includes(file)); + const newFiles = fs.readdirSync(domainsPath).filter((file) => !fs.readdirSync(headDomainsPath).includes(file.substring(MODIFIED_FILES[i].lastIndexOf("/") + 1))); newFiles.forEach((file) => { - const domain = fs.readJsonSync(path.join(domainsPath, file)); + const domain = fs.readJsonSync(path.join(domainsPath, file.substring(MODIFIED_FILES[i].lastIndexOf("/") + 1))); t.true( domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), From 2434b8b429d058add3a4ca0caf3135bcd499e627 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:54:52 +0800 Subject: [PATCH 31/51] Update pr.test.js --- tests/pr.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index 8a6ac0ebd..ff5bb2bd4 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -17,11 +17,11 @@ t("Modified JSON files must be owned by the PR author", (t) => { } MODIFIED_FILES.forEach((file) => { - const modifiedDomain = fs.readJsonSync(path.join(domainsPath, file.substring(MODIFIED_FILES[i].lastIndexOf("/") + 1))); + const modifiedDomain = fs.readJsonSync(path.join(domainsPath, file.substring(file.lastIndexOf("/") + 1))); let currentDomain = null; try { - currentDomain = fs.readJsonSync(path.join(headDomainsPath, file.substring(MODIFIED_FILES[i].lastIndexOf("/") + 1))); + currentDomain = fs.readJsonSync(path.join(headDomainsPath, file.substring(file.lastIndexOf("/") + 1))); } catch { currentDomain = modifiedDomain; } @@ -40,10 +40,10 @@ t("New JSON files must be owned by the PR author", (t) => { return; } - const newFiles = fs.readdirSync(domainsPath).filter((file) => !fs.readdirSync(headDomainsPath).includes(file.substring(MODIFIED_FILES[i].lastIndexOf("/") + 1))); + const newFiles = fs.readdirSync(domainsPath).filter((file) => !fs.readdirSync(headDomainsPath).includes(file.substring(file.lastIndexOf("/") + 1))); newFiles.forEach((file) => { - const domain = fs.readJsonSync(path.join(domainsPath, file.substring(MODIFIED_FILES[i].lastIndexOf("/") + 1))); + const domain = fs.readJsonSync(path.join(domainsPath, file.substring(file.lastIndexOf("/") + 1))); t.true( domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), From 69eba1e0ade080de607b2cbec1c4254c4803dda6 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:59:09 +0800 Subject: [PATCH 32/51] optimise? --- tests/pr.test.js | 81 +++++++++++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 29 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index ff5bb2bd4..9013d173d 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -3,51 +3,74 @@ const fs = require("fs-extra"); const path = require("path"); const PR_AUTHOR = process.env.PR_AUTHOR; -const MODIFIED_FILES = process.env.MODIFIED_FILES.split(" "); +const MODIFIED_FILES = (process.env.MODIFIED_FILES || "").split(" "); +const EVENT = process.env.EVENT; +const RUN_ID = process.env.RUN_ID; const domainsPath = path.resolve("domains"); -const headDomainsPath = path.resolve(`register-${process.env.RUN_ID}/domains`); +const headDomainsPath = path.resolve(`register-${RUN_ID}/domains`); const admins = require("../util/administrators.json"); -t("Modified JSON files must be owned by the PR author", (t) => { - if(process.env.EVENT !== "pull_request") { +async function getFileContent(basePath, fileName) { + try { + return await fs.readJson(path.join(basePath, fileName)); + } catch (err) { + return null; + } +} + +t("Modified JSON files must be owned by the PR author", async (t) => { + if (EVENT !== "pull_request") { t.pass(); return; } - MODIFIED_FILES.forEach((file) => { - const modifiedDomain = fs.readJsonSync(path.join(domainsPath, file.substring(file.lastIndexOf("/") + 1))); - let currentDomain = null; + await Promise.all( + MODIFIED_FILES.map(async (file) => { + const fileName = file.substring(file.lastIndexOf("/") + 1); + const modifiedDomain = await getFileContent(domainsPath, fileName); + const currentDomain = (await getFileContent(headDomainsPath, fileName)) || modifiedDomain; - try { - currentDomain = fs.readJsonSync(path.join(headDomainsPath, file.substring(file.lastIndexOf("/") + 1))); - } catch { - currentDomain = modifiedDomain; - } + if (!modifiedDomain || !currentDomain) { + t.fail(`${file}: Unable to read domain data`); + return; + } - t.true( - currentDomain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), - `${file}: Domain owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` - ); - }); + t.true( + currentDomain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), + `${file}: Domain owner is ${currentDomain.owner.username} but ${PR_AUTHOR} is the PR author` + ); + }) + ); }); - -t("New JSON files must be owned by the PR author", (t) => { - if(process.env.EVENT !== "pull_request") { +t("New JSON files must be owned by the PR author", async (t) => { + if (EVENT !== "pull_request") { t.pass(); return; } - const newFiles = fs.readdirSync(domainsPath).filter((file) => !fs.readdirSync(headDomainsPath).includes(file.substring(file.lastIndexOf("/") + 1))); + const domainsFiles = await fs.readdir(domainsPath); + const headDomainsFiles = await fs.readdir(headDomainsPath).catch(() => []); - newFiles.forEach((file) => { - const domain = fs.readJsonSync(path.join(domainsPath, file.substring(file.lastIndexOf("/") + 1))); + const newFiles = domainsFiles.filter( + (file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1)) + ); - t.true( - domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), - `${file}: Domain owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` - ); - }); -}) + await Promise.all( + newFiles.map(async (file) => { + const domain = await getFileContent(domainsPath, file); + + if (!domain) { + t.fail(`${file}: Unable to read domain data`); + return; + } + + t.true( + domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), + `${file}: Domain owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` + ); + }) + ); +}); From d3c928e900f8986aef215769a3d765c22c112fd5 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:04:44 +0800 Subject: [PATCH 33/51] Update pr.test.js --- tests/pr.test.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index 9013d173d..2d2f5123b 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -43,21 +43,22 @@ t("Modified JSON files must be owned by the PR author", async (t) => { ); }) ); + + t.pass(); }); t("New JSON files must be owned by the PR author", async (t) => { - if (EVENT !== "pull_request") { - t.pass(); - return; - } + if (EVENT !== "pull_request") return t.pass(); const domainsFiles = await fs.readdir(domainsPath); - const headDomainsFiles = await fs.readdir(headDomainsPath).catch(() => []); + const headDomainsFiles = await fs.readdir(headDomainsPath); const newFiles = domainsFiles.filter( (file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1)) ); + console.log("New files", newFiles); + await Promise.all( newFiles.map(async (file) => { const domain = await getFileContent(domainsPath, file); @@ -73,4 +74,6 @@ t("New JSON files must be owned by the PR author", async (t) => { ); }) ); + + t.pass(); }); From b93d0f85a13922454252dc7ca25224161811fa84 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:07:35 +0800 Subject: [PATCH 34/51] Update pr.test.js --- tests/pr.test.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index 2d2f5123b..7c3f8ebd9 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -21,10 +21,9 @@ async function getFileContent(basePath, fileName) { } t("Modified JSON files must be owned by the PR author", async (t) => { - if (EVENT !== "pull_request") { - t.pass(); - return; - } + if (EVENT !== "pull_request") return t.pass(); + + console.log("Modified files", MODIFIED_FILES); await Promise.all( MODIFIED_FILES.map(async (file) => { @@ -50,12 +49,9 @@ t("Modified JSON files must be owned by the PR author", async (t) => { t("New JSON files must be owned by the PR author", async (t) => { if (EVENT !== "pull_request") return t.pass(); - const domainsFiles = await fs.readdir(domainsPath); const headDomainsFiles = await fs.readdir(headDomainsPath); - const newFiles = domainsFiles.filter( - (file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1)) - ); + const newFiles = MODIFIED_FILES.filter((file) => !headDomainsFiles.includes(file)); console.log("New files", newFiles); From a07afe4762bf5e137593c24ea8e88911dbaa7a99 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:10:31 +0800 Subject: [PATCH 35/51] Update pr.test.js --- tests/pr.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index 7c3f8ebd9..dcc6ca21f 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -51,13 +51,13 @@ t("New JSON files must be owned by the PR author", async (t) => { const headDomainsFiles = await fs.readdir(headDomainsPath); - const newFiles = MODIFIED_FILES.filter((file) => !headDomainsFiles.includes(file)); + const newFiles = MODIFIED_FILES.filter((file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1))); console.log("New files", newFiles); await Promise.all( newFiles.map(async (file) => { - const domain = await getFileContent(domainsPath, file); + const domain = await getFileContent(domainsPath, file.substring(file.lastIndexOf("/") + 1)); if (!domain) { t.fail(`${file}: Unable to read domain data`); From c2706077dfa568c495be7a952b87f605230590a7 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:13:04 +0800 Subject: [PATCH 36/51] Update pr.test.js --- tests/pr.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index dcc6ca21f..b39f16190 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -49,7 +49,7 @@ t("Modified JSON files must be owned by the PR author", async (t) => { t("New JSON files must be owned by the PR author", async (t) => { if (EVENT !== "pull_request") return t.pass(); - const headDomainsFiles = await fs.readdir(headDomainsPath); + const headDomainsFiles = fs.readdirSync(headDomainsPath); const newFiles = MODIFIED_FILES.filter((file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1))); From 28c053b4f891d8babb97f1615f2c578f072d34b1 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:13:12 +0800 Subject: [PATCH 37/51] Update pr.test.js --- tests/pr.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/pr.test.js b/tests/pr.test.js index b39f16190..88c220716 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -51,6 +51,8 @@ t("New JSON files must be owned by the PR author", async (t) => { const headDomainsFiles = fs.readdirSync(headDomainsPath); + console.log("Head files", headDomainsFiles); + const newFiles = MODIFIED_FILES.filter((file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1))); console.log("New files", newFiles); From e857069a2139ee467a15279a4e6b2436d4e4c028 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:14:59 +0800 Subject: [PATCH 38/51] Update pr.test.js --- tests/pr.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index 88c220716..e571b3a5c 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -51,7 +51,9 @@ t("New JSON files must be owned by the PR author", async (t) => { const headDomainsFiles = fs.readdirSync(headDomainsPath); - console.log("Head files", headDomainsFiles); + console.log("Head files", headDomainsFiles.filter((file) => MODIFIED_FILES.includes(file.substring(file.lastIndexOf("/") + 1)))); + + console.log("Modified files", MODIFIED_FILES.map((file) => file.substring(file.lastIndexOf("/") + 1))); const newFiles = MODIFIED_FILES.filter((file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1))); From a52a3666612ada48c4e830a4c210f06500a56560 Mon Sep 17 00:00:00 2001 From: iostpa Date: Thu, 2 Jan 2025 14:15:09 +0200 Subject: [PATCH 39/51] Update domains/hash-cracker.json --- domains/hash-cracker.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domains/hash-cracker.json b/domains/hash-cracker.json index 576894dc0..3e99e874d 100644 --- a/domains/hash-cracker.json +++ b/domains/hash-cracker.json @@ -3,7 +3,7 @@ "repo": "https://github.com/hash-cracker/hash-cracker.github.io", "owner": { "username": "hash-cracker", - "email": "tspamiitesh@gmail.com", + "email": "tspamiitesh@gmail.com" }, "record": { "CNAME": "hash-cracker.github.io" From e32bacdf9510471f6ef5994a3fefd113659fbe11 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:20:10 +0800 Subject: [PATCH 40/51] Update pr.test.js --- tests/pr.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index e571b3a5c..2be0b763d 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -51,11 +51,11 @@ t("New JSON files must be owned by the PR author", async (t) => { const headDomainsFiles = fs.readdirSync(headDomainsPath); - console.log("Head files", headDomainsFiles.filter((file) => MODIFIED_FILES.includes(file.substring(file.lastIndexOf("/") + 1)))); + console.log("Head files", headDomainsFiles.filter((file) => MODIFIED_FILES.includes(`domains/${file}`))); console.log("Modified files", MODIFIED_FILES.map((file) => file.substring(file.lastIndexOf("/") + 1))); - const newFiles = MODIFIED_FILES.filter((file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1))); + const newFiles = MODIFIED_FILES.map((file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1))); console.log("New files", newFiles); From b31ac96e45960b875c418d701880ce022bc52f6b Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:24:21 +0800 Subject: [PATCH 41/51] Update validation.yml --- .github/workflows/validation.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index f77187016..aba28c94c 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -41,6 +41,9 @@ jobs: repository: is-a-dev/register path: register-${{ github.run_id }} + - run: ls domain -1 | wc -l + - run: ls register-${{ github.run_id }}/domains -1 | wc -l + - run: npm install - name: Get all modified domain JSON files From 70dd4633a45dcbd29ba38245f326bafae1b20749 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:25:34 +0800 Subject: [PATCH 42/51] Update pr.test.js --- tests/pr.test.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index 2be0b763d..f4a5a2cce 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -50,12 +50,9 @@ t("New JSON files must be owned by the PR author", async (t) => { if (EVENT !== "pull_request") return t.pass(); const headDomainsFiles = fs.readdirSync(headDomainsPath); - - console.log("Head files", headDomainsFiles.filter((file) => MODIFIED_FILES.includes(`domains/${file}`))); - - console.log("Modified files", MODIFIED_FILES.map((file) => file.substring(file.lastIndexOf("/") + 1))); - - const newFiles = MODIFIED_FILES.map((file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1))); + + // get list of all files that are in the base dir but not in the head dir + const newFiles = headDomainsFiles.filter((file) => !fs.existsSync(path.join(domainsPath, file))); console.log("New files", newFiles); From 76914ef175cb65be99cb999dbfba40af28a88664 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:29:08 +0800 Subject: [PATCH 43/51] try fix --- .github/workflows/validation.yml | 2 +- tests/pr.test.js | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index aba28c94c..ac0ca8394 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -41,7 +41,7 @@ jobs: repository: is-a-dev/register path: register-${{ github.run_id }} - - run: ls domain -1 | wc -l + - run: ls domains -1 | wc -l - run: ls register-${{ github.run_id }}/domains -1 | wc -l - run: npm install diff --git a/tests/pr.test.js b/tests/pr.test.js index f4a5a2cce..15b00c813 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -3,7 +3,7 @@ const fs = require("fs-extra"); const path = require("path"); const PR_AUTHOR = process.env.PR_AUTHOR; -const MODIFIED_FILES = (process.env.MODIFIED_FILES || "").split(" "); +const MODIFIED_FILES = (process.env.MODIFIED_FILES || "").split(" ").map(file => file.replace(/^domains\//, "")); const EVENT = process.env.EVENT; const RUN_ID = process.env.RUN_ID; @@ -23,13 +23,10 @@ async function getFileContent(basePath, fileName) { t("Modified JSON files must be owned by the PR author", async (t) => { if (EVENT !== "pull_request") return t.pass(); - console.log("Modified files", MODIFIED_FILES); - await Promise.all( MODIFIED_FILES.map(async (file) => { - const fileName = file.substring(file.lastIndexOf("/") + 1); - const modifiedDomain = await getFileContent(domainsPath, fileName); - const currentDomain = (await getFileContent(headDomainsPath, fileName)) || modifiedDomain; + const modifiedDomain = await getFileContent(domainsPath, file); + const currentDomain = (await getFileContent(headDomainsPath, file)) || modifiedDomain; if (!modifiedDomain || !currentDomain) { t.fail(`${file}: Unable to read domain data`); @@ -51,14 +48,13 @@ t("New JSON files must be owned by the PR author", async (t) => { const headDomainsFiles = fs.readdirSync(headDomainsPath); - // get list of all files that are in the base dir but not in the head dir const newFiles = headDomainsFiles.filter((file) => !fs.existsSync(path.join(domainsPath, file))); console.log("New files", newFiles); await Promise.all( newFiles.map(async (file) => { - const domain = await getFileContent(domainsPath, file.substring(file.lastIndexOf("/") + 1)); + const domain = await getFileContent(domainsPath, file); if (!domain) { t.fail(`${file}: Unable to read domain data`); From 7f6467ea4153204462894d4ccdb28c61d291ab7c Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:31:24 +0800 Subject: [PATCH 44/51] fix cloning --- .github/workflows/validation.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index ac0ca8394..f27cd2dbe 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -36,10 +36,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/checkout@v4 - with: - repository: is-a-dev/register - path: register-${{ github.run_id }} + - run: git clone https://github.com/is-a-dev/register.git register-${{ github.run_id }} - run: ls domains -1 | wc -l - run: ls register-${{ github.run_id }}/domains -1 | wc -l From 55b60ba3f72d7fab787a2b7ff290bdbd004bc5f0 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:33:37 +0800 Subject: [PATCH 45/51] fixes --- .github/workflows/validation.yml | 6 ++---- tests/pr.test.js | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index f27cd2dbe..6e86fabc5 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -36,10 +36,8 @@ jobs: steps: - uses: actions/checkout@v4 - - run: git clone https://github.com/is-a-dev/register.git register-${{ github.run_id }} - - - run: ls domains -1 | wc -l - - run: ls register-${{ github.run_id }}/domains -1 | wc -l + - name: Clone is-a-dev/register + run: git clone https://github.com/is-a-dev/register.git register-${{ github.run_id }} - run: npm install diff --git a/tests/pr.test.js b/tests/pr.test.js index 15b00c813..ecfe7605e 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -48,9 +48,7 @@ t("New JSON files must be owned by the PR author", async (t) => { const headDomainsFiles = fs.readdirSync(headDomainsPath); - const newFiles = headDomainsFiles.filter((file) => !fs.existsSync(path.join(domainsPath, file))); - - console.log("New files", newFiles); + const newFiles = domainsPath.filter((file) => !fs.existsSync(path.join(headDomainsFiles, file))); await Promise.all( newFiles.map(async (file) => { From 759001598cf45ba9baf6f23c79393423c5a51b1c Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:33:54 +0800 Subject: [PATCH 46/51] Update pr.test.js --- tests/pr.test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index ecfe7605e..a590b0b4c 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -3,7 +3,7 @@ const fs = require("fs-extra"); const path = require("path"); const PR_AUTHOR = process.env.PR_AUTHOR; -const MODIFIED_FILES = (process.env.MODIFIED_FILES || "").split(" ").map(file => file.replace(/^domains\//, "")); +const MODIFIED_FILES = (process.env.MODIFIED_FILES || "").split(" ").map((file) => file.replace(/^domains\//, "")); const EVENT = process.env.EVENT; const RUN_ID = process.env.RUN_ID; @@ -47,9 +47,11 @@ t("New JSON files must be owned by the PR author", async (t) => { if (EVENT !== "pull_request") return t.pass(); const headDomainsFiles = fs.readdirSync(headDomainsPath); - + const newFiles = domainsPath.filter((file) => !fs.existsSync(path.join(headDomainsFiles, file))); + console.log(newFiles); + await Promise.all( newFiles.map(async (file) => { const domain = await getFileContent(domainsPath, file); From 345104c3343e3e1990c8e06b7e706e661c8c41b7 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:39:48 +0800 Subject: [PATCH 47/51] Update pr.test.js --- tests/pr.test.js | 63 +++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index a590b0b4c..7bb79061b 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -12,10 +12,10 @@ const headDomainsPath = path.resolve(`register-${RUN_ID}/domains`); const admins = require("../util/administrators.json"); -async function getFileContent(basePath, fileName) { +async function getJSONContent(basePath, fileName) { try { return await fs.readJson(path.join(basePath, fileName)); - } catch (err) { + } catch { return null; } } @@ -23,50 +23,47 @@ async function getFileContent(basePath, fileName) { t("Modified JSON files must be owned by the PR author", async (t) => { if (EVENT !== "pull_request") return t.pass(); - await Promise.all( - MODIFIED_FILES.map(async (file) => { - const modifiedDomain = await getFileContent(domainsPath, file); - const currentDomain = (await getFileContent(headDomainsPath, file)) || modifiedDomain; + const checks = MODIFIED_FILES.map(async (file) => { + const [modifiedDomain, currentDomain] = await Promise.all([ + getJSONContent(domainsPath, file), + getJSONContent(headDomainsPath, file) + ]); - if (!modifiedDomain || !currentDomain) { - t.fail(`${file}: Unable to read domain data`); - return; - } + const domainToCheck = currentDomain || modifiedDomain; - t.true( - currentDomain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), - `${file}: Domain owner is ${currentDomain.owner.username} but ${PR_AUTHOR} is the PR author` - ); - }) - ); + if (!modifiedDomain || !domainToCheck) { + t.fail(`${file}: Unable to read domain data`); + return; + } + t.true( + domainToCheck.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), + `${file}: Domain owner is ${domainToCheck.owner.username} but ${PR_AUTHOR} is the PR author` + ); + }); + + await Promise.all(checks); t.pass(); }); t("New JSON files must be owned by the PR author", async (t) => { if (EVENT !== "pull_request") return t.pass(); - const headDomainsFiles = fs.readdirSync(headDomainsPath); + const [newFiles, currentFiles] = await Promise.all([fs.readdir(domainsPath), fs.readdir(headDomainsPath)]); - const newFiles = domainsPath.filter((file) => !fs.existsSync(path.join(headDomainsFiles, file))); + const newDomainFiles = newFiles.filter((file) => !currentFiles.includes(file)); - console.log(newFiles); + const checks = newDomainFiles.map(async (file) => { + const domain = await getJSONContent(domainsPath, file); - await Promise.all( - newFiles.map(async (file) => { - const domain = await getFileContent(domainsPath, file); + if (!domain) return t.fail(`${file}: Unable to read domain data`); - if (!domain) { - t.fail(`${file}: Unable to read domain data`); - return; - } - - t.true( - domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), - `${file}: Domain owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` - ); - }) - ); + t.true( + domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR), + `${file}: Domain owner is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` + ); + }); + await Promise.all(checks); t.pass(); }); From 4ca07a5bf394ae3e8dda44c35289279ba90bb89b Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:42:16 +0800 Subject: [PATCH 48/51] Update pr.test.js --- tests/pr.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/pr.test.js b/tests/pr.test.js index 7bb79061b..d0b08ce7c 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -53,6 +53,8 @@ t("New JSON files must be owned by the PR author", async (t) => { const newDomainFiles = newFiles.filter((file) => !currentFiles.includes(file)); + console.log(newDomainFiles); + const checks = newDomainFiles.map(async (file) => { const domain = await getJSONContent(domainsPath, file); From 476e9c6ef7349d8560c3e7732e5f2cb8c49a8d64 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:43:33 +0800 Subject: [PATCH 49/51] Update pr.test.js --- tests/pr.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/pr.test.js b/tests/pr.test.js index d0b08ce7c..7bb79061b 100644 --- a/tests/pr.test.js +++ b/tests/pr.test.js @@ -53,8 +53,6 @@ t("New JSON files must be owned by the PR author", async (t) => { const newDomainFiles = newFiles.filter((file) => !currentFiles.includes(file)); - console.log(newDomainFiles); - const checks = newDomainFiles.map(async (file) => { const domain = await getJSONContent(domainsPath, file); From 573a974225f0c56520abd44e1a6e05821f77b5cc Mon Sep 17 00:00:00 2001 From: iostpa Date: Thu, 2 Jan 2025 14:47:11 +0200 Subject: [PATCH 50/51] Needs to be the exact username --- domains/hash-cracker.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domains/hash-cracker.json b/domains/hash-cracker.json index 3e99e874d..3c63d2ca7 100644 --- a/domains/hash-cracker.json +++ b/domains/hash-cracker.json @@ -2,7 +2,7 @@ "description": "A portfolio website", "repo": "https://github.com/hash-cracker/hash-cracker.github.io", "owner": { - "username": "hash-cracker", + "username": "Hash-Cracker", "email": "tspamiitesh@gmail.com" }, "record": { From 8970c1a5a04c1f81a46299f210191b0951660eeb Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:48:36 +0800 Subject: [PATCH 51/51] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index fa62aa12d..49cc4532e 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -14,7 +14,7 @@ The abuse reports will be investigated and the necessary action will be taken. - Online stores/shopping websites - Gambling websites - Game cheat sites -- CDNs distributing potentially malicious content (APKs, executables) +- CDNs distributing potentially malicious content (e.g. APKs, executables) - 'Unblocked' gaming websites - Alternate URLs for commonly blocked websites (e.g. gambling/casino websites) - Websites containing 18+ content @@ -28,3 +28,4 @@ The abuse reports will be investigated and the necessary action will be taken. - Online services for identity theft or forgery - Platforms promoting self-harm or violence - Illegal drug marketplaces +- Proxy sites (e.g. embedding other websites)