Compare commits

..

2 Commits

Author SHA1 Message Date
d058ba8eed Add jsonl output to releases
Some checks failed
Generate Release / validate_and_release (push) Failing after 7s
2026-01-03 23:35:58 +00:00
36243c7457 Remove 'toc' from output files, this will be handled by data-ingress 2026-01-03 23:11:43 +00:00
4 changed files with 43 additions and 1 deletions

View File

@@ -20,6 +20,20 @@ jobs:
id: timestamp
run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M%S')"
- name: Install Dependencies
run: npm i
- name: Create JSON Lines
run: node ./scripts/ndjson-out.js ./pis/codes.yaml
- name: Verify JSONL Output
run: |
if [ ! -s pis-objects.jsonl ]; then
echo "Error: pis-objects.jsonl is empty or missong"
exit 1
fi
echo "File verified"
- name: Create Release
if: success()
uses: akkuman/gitea-release-action@v1
@@ -30,3 +44,5 @@ jobs:
tag_name: ${{ steps.timestamp.outputs.date }}
name: ${{ steps.timestamp.outputs.date }}
token: ${{ secrets.OWLBOT_KEY }}
files: |
release-data.jsonl

View File

@@ -41,7 +41,6 @@ function sortAndMergeYAMLFiles() {
seenCodes.add(item.code);
outputString += ` - code: "${item.code}"\n`;
outputString += ` stops: [${item.stops.map(stop => `${stop}`).join(',')}]\n`;
outputString += ` toc: "${item.toc || "gw"}"\n`;
}
});

27
scripts/ndjson-out.js Normal file
View File

@@ -0,0 +1,27 @@
const fs = require('fs');
const yaml = require('yaml');
const inputFile = process.argv[2];
const outputFile = 'pis-objects.jsonl';
if (!inputFile) {
console.error('Please provide an input YAML file');
process.exit(1);
}
try {
const fileContent = fs.readFileSync(inputFile, 'utf8');
const data = yaml.loadAll(fileContent);
if (!data || !data.pis || !Array.isArray(data.pis)) {
throw new Error('Invalid structure: Expected object with "pis" array.');
}
const jsonl = data.pis.map(item => JSON.stringify(item));
fs.writeFileSync(outputFile, jsonl.join('\n') + '\n');
console.log(`Successfully processed ${data.pis.length} items.`);
} catch (e) {
console.error("Conversion failed: ", e.message);
process.exit(1);
}

0
scripts/test.yaml Normal file
View File