From 18251f9470636f348dd40b1c9965c1dd874e2054 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:37:27 -0500 Subject: [PATCH 1/9] Update json.test.js --- tests/json.test.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index f1bd162c..e38c15d0 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -41,32 +41,6 @@ function validateOptionalFields(t, obj, optionalFields, file) { }); } -t("All files should be valid JSON", (t) => { - files.forEach((file) => { - t.notThrows(() => fs.readJsonSync(path.join(domainsPath, file)), `${file}: Invalid JSON file`); - }); -}); - -t("All files should have valid file names", (t) => { - files.forEach((file) => { - t.true(file.endsWith(".json"), `${file}: File does not have .json extension`); - - // Check for any unwanted domain in file names - t.false(Domains.some(domain => file.endsWith(domain + ".json")), `${file}: File name should not contain restricted domain extensions`); - - t.true(file === file.toLowerCase(), `${file}: File name should be lowercase`); - - // Ignore root domain - if (!rootDomainFiles.includes(file)) { - t.regex( - file.replace(/\.json$/, ""), - hostnameRegex, - `${file}: FQDN must be 1-253 characters, use letters, numbers, dots, or hyphens, and not start or end with a hyphen.` - ); - } - }); -}); - t("All files should have the required fields", (t) => { const files = fs.readdirSync(domainsPath).filter(file => { const filePath = path.join(domainsPath, file); From 82f8c2af53a0f55f0a970608053caa71bad47fd5 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:47:28 -0500 Subject: [PATCH 2/9] Update domains.test.js Match how is-a.dev has theirs --- tests/domains.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index 8cb68033..dfccdcf3 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -13,7 +13,7 @@ t("Nested subdomains should not exist without a parent subdomain", (t) => { return; // Skip directories } - const subdomain = file.replace(".json", ""); + const subdomain = file.replace(/\.json$/, ""); if (subdomain.split(".").length > 1) { // Get parent domain by removing the last part (subdomain) from the full subdomain @@ -38,7 +38,7 @@ t("Nested subdomains should not exist if the parent subdomain has NS records", ( return; // Skip directories } - const subdomain = file.replace(".json", ""); + const subdomain = file.replace(/\.json$/, ""); if (subdomain.split(".").length > 1) { // Get parent domain by removing the last part (subdomain) from the full subdomain From cf7cffa49a7e52c1f80ccabd08da30f8d4297ac3 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sat, 23 Nov 2024 12:14:27 -0500 Subject: [PATCH 3/9] chore: Make emails required and not optional --- tests/json.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index e38c15d0..d6d6ed6d 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -7,7 +7,7 @@ const requiredFields = { record: "object" }; -const optionalOwnerFields = { +const requiredOwnerFields = { email: "string" }; @@ -50,7 +50,7 @@ t("All files should have the required fields", (t) => { const data = fs.readJsonSync(path.join(domainsPath, file)); validateRequiredFields(t, data, requiredFields, file); - //validateRequiredFields(t, data.owner, requiredFields, file); + validateRequiredFields(t, data, requiredOwnerFields, file); if (!data.reserved) { t.true(Object.keys(data.record).length > 0, `${file}: No record types found`); @@ -58,7 +58,7 @@ t("All files should have the required fields", (t) => { }); }); -t("All files should have valid optional owner fields", (t) => { +/*t("All files should have valid optional owner fields", (t) => { const files = fs.readdirSync(domainsPath).filter(file => { const filePath = path.join(domainsPath, file); return fs.lstatSync(filePath).isFile(); // Only include files @@ -72,4 +72,4 @@ t("All files should have valid optional owner fields", (t) => { t.regex(data.owner.email, emailRegex, `${file}: Owner email should be a valid email address`); } }); -}); +});*/ From c1e0e904fe493a318e86a01c787891d73c41d2f0 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sat, 23 Nov 2024 12:18:06 -0500 Subject: [PATCH 4/9] Update json.test.js --- tests/json.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/json.test.js b/tests/json.test.js index d6d6ed6d..b0532c07 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -50,7 +50,7 @@ t("All files should have the required fields", (t) => { const data = fs.readJsonSync(path.join(domainsPath, file)); validateRequiredFields(t, data, requiredFields, file); - validateRequiredFields(t, data, requiredOwnerFields, file); + validateRequiredFields(t, data.owner, requiredOwnerFields, file); if (!data.reserved) { t.true(Object.keys(data.record).length > 0, `${file}: No record types found`); From 52160a20699bdc3b16f39cd7a9030002e02d7221 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sat, 23 Nov 2024 12:33:47 -0500 Subject: [PATCH 5/9] Update json.test.js --- tests/json.test.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index b0532c07..6bca94e5 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -7,7 +7,7 @@ const requiredFields = { record: "object" }; -const requiredOwnerFields = { +const optionalOwnerFields = { email: "string" }; @@ -50,7 +50,6 @@ t("All files should have the required fields", (t) => { const data = fs.readJsonSync(path.join(domainsPath, file)); validateRequiredFields(t, data, requiredFields, file); - validateRequiredFields(t, data.owner, requiredOwnerFields, file); if (!data.reserved) { t.true(Object.keys(data.record).length > 0, `${file}: No record types found`); @@ -58,7 +57,7 @@ t("All files should have the required fields", (t) => { }); }); -/*t("All files should have valid optional owner fields", (t) => { +t("All files should have valid optional owner fields", (t) => { const files = fs.readdirSync(domainsPath).filter(file => { const filePath = path.join(domainsPath, file); return fs.lstatSync(filePath).isFile(); // Only include files @@ -72,4 +71,4 @@ t("All files should have the required fields", (t) => { t.regex(data.owner.email, emailRegex, `${file}: Owner email should be a valid email address`); } }); -});*/ +}); From 385005ccd6583f3380e31a828e33b22573238fdb Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sat, 23 Nov 2024 12:58:14 -0500 Subject: [PATCH 6/9] Update proxy.test.js --- tests/proxy.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/proxy.test.js b/tests/proxy.test.js index b6b4396f..771a3225 100644 --- a/tests/proxy.test.js +++ b/tests/proxy.test.js @@ -2,7 +2,7 @@ const t = require("ava"); const fs = require("fs-extra"); const path = require("path"); -const requiredRecordsToProxy = ["A", "AAAA", "CAA", "CNAME", "MX", "NS", "SPF", "SRV"]; +const requiredRecordsToProxy = ["A", "AAAA", "CAA", "CNAME", "MX", "NS", "SRV"]; function validateProxiedRecords(t, data, file) { if (data.proxied) { From 4a30e12c3bedc57e0be864ce659ad993cfb87f98 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sat, 23 Nov 2024 13:10:50 -0500 Subject: [PATCH 7/9] Update validation.yml --- .github/workflows/validation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 86b77c43..a6768ac1 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -21,7 +21,6 @@ concurrency: jobs: dns: name: DNS - if: "!contains(github.event.head_commit.message, '[skip-ci]')" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 2f4480b2f6abef36fadb7ce7bace46ab6044e5e2 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sun, 24 Nov 2024 12:42:46 -0500 Subject: [PATCH 8/9] Update validation.yml --- .github/workflows/validation.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index a6768ac1..c5c5d8f0 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -17,12 +17,12 @@ on: concurrency: group: ${{ github.ref }}-validation cancel-in-progress: true - + jobs: dns: - name: DNS - runs-on: ubuntu-latest - steps: + name: DNS + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -37,15 +37,15 @@ jobs: id: dns_check uses: is-a-dev/dnscontrol-action@main with: - args: check - config_file: "dnsconfig.js" + args: check + config_file: "dnsconfig.js" - name: Add Validated DNS Label if: ${{ steps.dns_check.outcome == 'success' }} uses: actions-ecosystem/action-add-labels@v1 with: - labels: "Validated DNS" - github_token: ${{ steps.create_token.outputs.token }} + labels: "Validated DNS" + github_token: ${{ steps.create_token.outputs.token }} - name: Remove Invalid DNS Label if: ${{ steps.dns_check.outcome == 'success' }} uses: actions-ecosystem/action-remove-labels@v1 @@ -59,13 +59,12 @@ jobs: with: labels: "Invalid DNS" github_token: ${{ steps.create_token.outputs.token }} - - name: Remove Validated DNS Label if: ${{ failure() }} uses: actions-ecosystem/action-remove-labels@v1 with: - labels: "Validated DNS" - github_token: ${{ steps.create_token.outputs.token }} + labels: "Validated DNS" + github_token: ${{ steps.create_token.outputs.token }} json: name: JSON From bee91c21633550ad4455e2fdd188084c9d8d0125 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sun, 24 Nov 2024 22:45:40 -0500 Subject: [PATCH 9/9] 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 c5c5d8f0..0a68a483 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -1,7 +1,7 @@ name: Validation on: - pull_request: + pull_request_target: push: branches: [main]