Merge branch 'main' into patch-3

This commit is contained in:
DIBSTER authored and GitHub committed 2025-04-13 20:26:33 -04:00
commit e0300f0f34
2 files changed
+40 -12

No files matched your search

+30 -4
View File
@@ -23,7 +23,15 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Log Git State
run: |
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_SHA: $GITHUB_SHA"
echo "PR HEAD SHA: ${{ github.event.pull_request.head.sha }}"
git rev-parse --abbrev-ref HEAD
git log -1 --oneline
- id: create_token
uses: tibdex/github-app-token@v2
@@ -61,7 +69,7 @@ jobs:
labels: "Invalid DNS"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
- name: Remove Validated DNS Label
if: ${{ github.event_name == 'pull_request' && failure() }}
uses: actions-ecosystem/action-remove-labels@v1
@@ -76,7 +84,15 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Log Git State
run: |
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_SHA: $GITHUB_SHA"
echo "PR HEAD SHA: ${{ github.event.pull_request.head.sha }}"
git rev-parse --abbrev-ref HEAD
git log -1 --oneline
- id: create_token
uses: tibdex/github-app-token@v2
@@ -123,13 +139,23 @@ jobs:
labels: "Validated JSON"
github_token: ${{ steps.create_token.outputs.token }}
issue_number: ${{ github.event.pull_request.number }}
tests:
name: Tests
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Log Git State
run: |
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_SHA: $GITHUB_SHA"
echo "PR HEAD SHA: ${{ github.event.pull_request.head.sha }}"
git rev-parse --abbrev-ref HEAD
git log -1 --oneline
- run: npm install
+10 -8
View File
@@ -120,25 +120,27 @@ t("All files should have lowercase subdomain/domain and match filename", (t) =>
});
});
t("All files should use a valid root domain", (t) => {
t("All files must use a valid root domain in both file name and JSON content", (t) => {
const files = fs.readdirSync(domainsPath).filter(file => {
const filePath = path.join(domainsPath, file);
return file.endsWith(".json") && fs.lstatSync(filePath).isFile();
});
files.forEach(file => {
const data = fs.readJsonSync(path.join(domainsPath, file));
const filePath = path.join(domainsPath, file);
const data = fs.readJsonSync(filePath);
const domain = data.domain;
t.truthy(domain, `${file}: Missing domain field`);
t.true(
domains.includes(`.${domain}`),
`${file}: Domain '${domain}' is not in the list of allowed domains`
);
const domainWithDot = `.${domain}`;
t.true(domains.includes(domainWithDot), `${file}: Domain '${domain}' is not allowed`);
const endsWithValidDomain = domains.some(valid => file.endsWith(valid + ".json"));
t.true(endsWithValidDomain, `❌ Filename does not end with a valid root domain: ${file}`);
});
});
// Thanks is-a.dev for this.
t("JSON files should not be in the root directory", (t) => {
const rootFiles = fs
@@ -165,4 +167,4 @@ t("All files in the domains directory must have a .json extension", (t) => {
} else {
t.pass();
}
});
});