mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-15 20:15:58 +00:00
updates
This commit is contained in:
1 parent
b7739fb0c8
commit
f78a7beddc
3 files changed
+23
-26
No files matched your search
+15
-16
@@ -1,21 +1,20 @@
|
|||||||
name: StaleBOT
|
name: StaleBOT
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
name: 'Force cleanup'
|
schedule:
|
||||||
schedule:
|
- cron: "30 14 * * *"
|
||||||
- cron: "30 14 * * *"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v3
|
- uses: actions/stale@v3
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
days-before-stale: 7
|
days-before-stale: 7
|
||||||
days-before-close: 3
|
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-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'
|
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-issue-labels: "no-stale"
|
||||||
exempt-pr-labels: 'no-stale'
|
exempt-pr-labels: "no-stale"
|
||||||
@@ -36,15 +36,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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 install
|
||||||
|
|
||||||
- run: npm test
|
- run: npm test
|
||||||
env:
|
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 }}
|
MODIFIED_FILES: ${{ env.MODIFIED_FILES }}
|
||||||
+6
-3
@@ -1,5 +1,3 @@
|
|||||||
if (!process.env.PULL_REQUEST) return;
|
|
||||||
|
|
||||||
const t = require("ava");
|
const t = require("ava");
|
||||||
const fs = require("fs-extra");
|
const fs = require("fs-extra");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
@@ -12,12 +10,17 @@ const domainsPath = path.resolve("domains");
|
|||||||
const admins = require("../util/administrators.json");
|
const admins = require("../util/administrators.json");
|
||||||
|
|
||||||
t("Modified JSON files must be owned by the PR author", (t) => {
|
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) => {
|
MODIFIED_FILES.forEach((file) => {
|
||||||
const domain = fs.readJsonSync(path.join(domainsPath, file));
|
const domain = fs.readJsonSync(path.join(domainsPath, file));
|
||||||
|
|
||||||
t.true(
|
t.true(
|
||||||
domain.owner.username === PR_AUTHOR || admins.includes(PR_AUTHOR),
|
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`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user