From 2c7f7e9d3af5a922686d14c0e8f2b03fcfcd06ff Mon Sep 17 00:00:00 2001 From: Arrebol Date: Mon, 7 Aug 2023 15:54:25 +0800 Subject: [PATCH] Update diff.cjs --- .github/diff.cjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/diff.cjs b/.github/diff.cjs index 18e049ad0..58ed313c5 100644 --- a/.github/diff.cjs +++ b/.github/diff.cjs @@ -5,10 +5,10 @@ const core = require('@actions/core') function init() { const DEPLOY_DOMAIN = - process.env.DEPLOY_DOMAIN | 'https://yuanshen.site/docs/' + process.env.DEPLOY_DOMAIN || 'https://yuanshen.site/docs/' let result = '' let outRange = false - + console.log(process.env.DEPLOY_DOMAIN, DEPLOY_DOMAIN) function calculateHashForHTMLFiles(directoryPath) { const files = fs.readdirSync(core.toPlatformPath(directoryPath)) const result = {} @@ -21,7 +21,7 @@ function init() { const fileContent = fs.readFileSync(filePath, 'utf8') const hash = crypto.createHash('md5').update(fileContent).digest('hex') - result[filePath.substring(filePath.indexOf('\\') + 1)] = hash + result[filePath.substring(filePath.indexOf('dist') + 4)] = hash } else if (fileStats.isDirectory()) { const subDirectoryPath = path.join(directoryPath, file) const subDirectoryFiles = calculateHashForHTMLFiles(subDirectoryPath) // 递归调用遍历子目录 @@ -68,8 +68,8 @@ function init() { } const { changedFiles, newFiles } = compareFilesWithHash( - calculateHashForHTMLFiles(core.toPlatformPath('./src/dist')), - calculateHashForHTMLFiles(core.toPlatformPath('./src/_dist')) + calculateHashForHTMLFiles(core.toPlatformPath('./src/_dist')), + calculateHashForHTMLFiles(core.toPlatformPath('./src/dist')) ) if (changedFiles.length === 0 && newFiles.length === 0) {