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: on:
pull_request: pull_request:
types: [opened, edited, synchronize, ready_for_review, review_requested] types: [opened, edited, synchronize, ready_for_review, review_requested]
push:
- master
- develop
jobs: jobs:
build: build:
@ -33,3 +36,11 @@ jobs:
- name: Validate license info - name: Validate license info
run: npm run validate:licenses 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:docs": "ts-node scripts/generateDocs.ts",
"generate:layeroverview": "ts-node scripts/generateLayerOverview.ts --no-fail", "generate:layeroverview": "ts-node scripts/generateLayerOverview.ts --no-fail",
"generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail", "generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail",
"validate:layeroverview": "ts-node scripts/generateLayerOverview.ts", "validate:layeroverview": "ts-node scripts/generateLayerOverview.ts --report --no-fail",
"validate:licenses": "ts-node scripts/generateLicenseInfo.ts", "validate:licenses": "ts-node scripts/generateLicenseInfo.ts --report --no-fail",
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'", "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", "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/*/*", "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") const errors = layerErrorCount.concat(themeErrorCount).join("\n")
console.log(errors) console.log(errors)
const msg = (`Found ${errors.length} errors in the layers; ${themeErrorCount} errors in the themes`) const msg = (`Found ${errors.length} errors in the layers; ${themeErrorCount} errors in the themes`)
if(process.argv.indexOf("--no-fail") >= 0) {
console.log(msg) console.log(msg)
}else if(process.argv.indexOf("--report") >= 0){ if (process.argv.indexOf("--report") >= 0) {
writeFileSync("layer_report.txt", errors) writeFileSync("layer_report.txt", errors)
}else{ }
if (process.argv.indexOf("--no-fail") < 0) {
throw msg; throw msg;
} }
} }

View file

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