Experimenting with GH actions

This commit is contained in:
pietervdvn 2021-04-11 01:58:51 +02:00
parent 04b83311f7
commit 5ca83a4c03
4 changed files with 41 additions and 31 deletions

View file

@ -2,6 +2,9 @@ name: Pull request check
on:
pull_request:
types: [opened, edited, synchronize, ready_for_review, review_requested]
push:
- master
- develop
jobs:
build:
@ -33,3 +36,11 @@ jobs:
- name: Validate license info
run: npm run validate:licenses
- name: Set failure key
run: |
if [[ -f "layer_report.txt" || -f "missing_licenses.txt" ]]; then
echo "VALIDATION_FAILED=true" >>$GITHUB_ENV
fi
- name: Test variable
run: echo "${{ env.VALIDATION_FAILED }}"

View file

@ -17,8 +17,8 @@
"generate:docs": "ts-node scripts/generateDocs.ts",
"generate:layeroverview": "ts-node scripts/generateLayerOverview.ts --no-fail",
"generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail",
"validate:layeroverview": "ts-node scripts/generateLayerOverview.ts",
"validate:licenses": "ts-node scripts/generateLicenseInfo.ts",
"validate:layeroverview": "ts-node scripts/generateLayerOverview.ts --report --no-fail",
"validate:licenses": "ts-node scripts/generateLicenseInfo.ts --report --no-fail",
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'",
"generate": "npm run generate:images && npm run generate:translations && npm run generate:licenses",
"build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",

View file

@ -125,12 +125,12 @@ if (layerErrorCount.length + themeErrorCount.length == 0) {
const errors = layerErrorCount.concat(themeErrorCount).join("\n")
console.log(errors)
const msg = (`Found ${errors.length} errors in the layers; ${themeErrorCount} errors in the themes`)
if(process.argv.indexOf("--no-fail") >= 0) {
console.log(msg)
}else if(process.argv.indexOf("--report") >= 0){
if (process.argv.indexOf("--report") >= 0) {
writeFileSync("layer_report.txt", errors)
}else{
}
if (process.argv.indexOf("--no-fail") < 0) {
throw msg;
}
}

View file

@ -201,11 +201,10 @@ if(process.argv.indexOf("--prompt") >= 0 || process.argv.indexOf("--query") >= 0
if (missingLicenses.length > 0) {
const msg = `There are ${missingLicenses.length} licenses missing.`
console.error(msg)
if(process.argv.indexOf("--no-fail") >= 0){
}else if(process.argv.indexOf("--report") >= 0){
if (process.argv.indexOf("--report") >= 0) {
writeFileSync("missing_licenses.txt", missingLicenses.join("\n"))
} else{
}
if (process.argv.indexOf("--no-fail") < 0) {
throw msg
}
}