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 d48c9a347..3b9476f0e 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -38,4 +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: ${{ steps.files.outputs.files || '' }} diff --git a/domains/1-train-ride-in-germany-is-300-euros.json b/domains/1-train-ride-in-germany-is-300-euros.json deleted file mode 100644 index e809964fb..000000000 --- a/domains/1-train-ride-in-germany-is-300-euros.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "owner": { - "username": "Yunexiz", - "discord": "1040303561847881729" - }, - "record": { - "A": [ - "185.199.109.153", - "185.199.108.153", - "185.199.110.153", - "185.199.111.153" - ] - } -} diff --git a/domains/_github-pages-challenge-yunexiz.1-train-ride-in-germany-is-300-euros.json b/domains/_github-pages-challenge-yunexiz.1-train-ride-in-germany-is-300-euros.json deleted file mode 100644 index 73f4376f4..000000000 --- a/domains/_github-pages-challenge-yunexiz.1-train-ride-in-germany-is-300-euros.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "Yunexiz", - "discord": "1040303561847881729" - }, - "record": { - "TXT": "a39a9e9549128753e8f6757a37d2c2" - } -} diff --git a/domains/_github-pages-challenge-yunexiz.ai-y.yunexiz.json b/domains/_github-pages-challenge-yunexiz.ai-y.yunexiz.json deleted file mode 100644 index 5e584ec99..000000000 --- a/domains/_github-pages-challenge-yunexiz.ai-y.yunexiz.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "yunexiz", - "discord": "1040303561847881729" - }, - "record": { - "TXT": "44acf50d05a09c5bdcb82f64551e6c" - } -} diff --git a/domains/ai-y.json b/domains/ai-y.json deleted file mode 100644 index 1ba829032..000000000 --- a/domains/ai-y.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "yunexiz", - "discord": "1040303561847881729" - }, - "record": { - "CNAME": "ai-y.onrender.com" - } -} diff --git a/domains/ai-y.yosuke.json b/domains/ai-y.yosuke.json deleted file mode 100644 index 632f9c315..000000000 --- a/domains/ai-y.yosuke.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "yunexiz", - "discord": "1040303561847881729" - }, - "record": { - "CNAME": "ai-y-main.pages.dev" - } -} diff --git a/domains/ai-y.yunexiz.json b/domains/ai-y.yunexiz.json deleted file mode 100644 index 0ab726729..000000000 --- a/domains/ai-y.yunexiz.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "yunexiz", - "discord": "1040303561847881729" - }, - "record": { - "CNAME": "yunexiz.github.io" - } -} diff --git a/domains/chattingmessenger.json b/domains/chattingmessenger.json new file mode 100644 index 000000000..c2652d957 --- /dev/null +++ b/domains/chattingmessenger.json @@ -0,0 +1,9 @@ +{ + "owner": { + "username": "riotoff", + "discord": "1040929084684902460" + }, + "record": { + "CNAME": "riotoff.github.io" + } +} 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" - } -} diff --git a/tests/pr.test.js b/tests/pr.test.js new file mode 100644 index 000000000..98a153a7d --- /dev/null +++ b/tests/pr.test.js @@ -0,0 +1,26 @@ +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) => { + 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 is ${domain.owner.username} but ${PR_AUTHOR} is the PR author` + ); + }); +}); 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",