拒绝在CI环境使用不干净的工作区构建应用

pull/1853/head
lyswhut 2024-04-13 18:59:42 +08:00
parent e7630e98d9
commit 65ab26365d
3 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,9 @@ on:
branches:
- beta
env:
IS_CI: 'true'
jobs:
# CheckCode:
# name: Lint Code

View File

@ -5,6 +5,9 @@ on:
branches:
- master
env:
IS_CI: 'true'
jobs:
# CheckCode:
# name: Lint Code

View File

@ -22,6 +22,8 @@ try {
if (!execSync('git status --porcelain').toString().trim()) {
gitInfo.commit_id = execSync('git log -1 --pretty=format:"%H"').toString().trim()
gitInfo.commit_date = execSync('git log -1 --pretty=format:"%ad" --date=iso-strict').toString().trim()
} else if (process.env.IS_CI) {
throw new Error('Working directory is not clean')
}
} catch {}