Update pr.test.js

This commit is contained in:
Stefano Del Prete
2025-01-02 15:30:17 +01:00
committed by GitHub
parent d966e9cbfa
commit ce30624074
+5 -3
View File
@@ -3,12 +3,12 @@ const fs = require("fs-extra");
const path = require("path");
const PR_AUTHOR = process.env.PR_AUTHOR.toLowerCase();
const MODIFIED_DOMAIN_FILES = (process.env.MODIFIED_FILES || "").split(" ").map((file) => file.replace(/^domains\//, ""));
const MODIFIED_DOMAIN_FILES = (process.env.MODIFIED_FILES || "").length > 0
? (process.env.MODIFIED_FILES || "").split(" ").map((file) => file.replace(/^domains\//, ""))
: null;
const EVENT = process.env.EVENT;
const RUN_ID = process.env.RUN_ID;
console.log(process.env.MODIFIED_FILES.length)
const domainsPath = path.resolve("domains");
const headDomainsPath = path.resolve(`register-${RUN_ID}/domains`);
@@ -24,6 +24,7 @@ async function getJSONContent(basePath, fileName) {
t("Modified JSON files must be owned by the PR author", async (t) => {
if (EVENT !== "pull_request") return t.pass();
if (!MODIFIED_DOMAIN_FILES) return t.pass();
const checks = MODIFIED_DOMAIN_FILES.map(async (file) => {
const [modifiedDomain, currentDomain] = await Promise.all([
@@ -50,6 +51,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();
if (!MODIFIED_DOMAIN_FILES) return t.pass();
const [newFiles, currentFiles] = await Promise.all([fs.readdir(domainsPath), fs.readdir(headDomainsPath)]);