Experimenting with GH Actions

This commit is contained in:
pietervdvn 2021-04-11 03:17:59 +02:00
parent ad53768ac7
commit 52bf5d73ce
3 changed files with 8 additions and 4 deletions

View File

@ -35,7 +35,9 @@ jobs:
- name: Set failure key
run: |
ls
if [[ -f "layer_report.txt" || -f "missing_licenses.txt" ]]; then
echo "Found a report..."
echo "VALIDATION_FAILED=true" >> $GITHUB_ENV
else
echo "VALIDATION_FAILED=false" >> $GITHUB_ENV

View File

@ -56,7 +56,7 @@ const linuxHints = []
function validateLayer(layerJson: LayerConfigJson, context?: string): string[] {
let errorCount = [];
if (layerJson["overpassTags"] !== undefined) {
errorCount.push("Layer "+ layerJson.id+ "still uses the old 'overpassTags'-format. Please use \"source\": {\"osmTags\": <tags>}' instead of \"overpassTags\": <tags> (note: this isn't your fault, the custom theme generator still spits out the old format)")
errorCount.push("Layer " + layerJson.id + "still uses the old 'overpassTags'-format. Please use \"source\": {\"osmTags\": <tags>}' instead of \"overpassTags\": <tags> (note: this isn't your fault, the custom theme generator still spits out the old format)")
}
try {
const layer = new LayerConfig(layerJson, "test", true)
@ -65,7 +65,7 @@ function validateLayer(layerJson: LayerConfigJson, context?: string): string[] {
for (const remoteImage of remoteImages) {
errorCount.push("Found a remote image: " + remoteImage + " in layer " + layer.id + ", please download it.")
const path = remoteImage.substring(remoteImage.lastIndexOf("/") + 1)
linuxHints.push("wget "+remoteImage)
linuxHints.push("wget " + remoteImage)
linuxHints.push(`echo '{"path":"${path}", "license": "<insert license here>", "authors": [ "<insert author(s) here"], "sources": [${remoteImage}]`)
}
for (const image of images) {
@ -130,9 +130,10 @@ if (layerErrorCount.length + themeErrorCount.length == 0) {
const msg = (`Found ${layerErrorCount.length} errors in the layers; ${themeErrorCount.length} errors in the themes`)
console.log(msg)
if (process.argv.indexOf("--report") >= 0) {
console.log("Writing report!")
writeFileSync("layer_report.txt", errors)
}
if (process.argv.indexOf("--no-fail") < 0) {
throw msg;
}

View File

@ -202,7 +202,8 @@ if (missingLicenses.length > 0) {
const msg = `There are ${missingLicenses.length} licenses missing.`
console.error(msg)
if (process.argv.indexOf("--report") >= 0) {
writeFileSync("missing_licenses.txt", missingLicenses.join("\n"))
console.log("Writing report!")
writeFileSync("missing_licenses.txt", missingLicenses.join("\n"))
}
if (process.argv.indexOf("--no-fail") < 0) {
throw msg