Add jsonl output to releases
Some checks failed
Generate Release / validate_and_release (push) Failing after 7s
Some checks failed
Generate Release / validate_and_release (push) Failing after 7s
This commit is contained in:
@@ -20,6 +20,20 @@ jobs:
|
|||||||
id: timestamp
|
id: timestamp
|
||||||
run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M%S')"
|
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
|
- name: Create Release
|
||||||
if: success()
|
if: success()
|
||||||
uses: akkuman/gitea-release-action@v1
|
uses: akkuman/gitea-release-action@v1
|
||||||
@@ -30,3 +44,5 @@ jobs:
|
|||||||
tag_name: ${{ steps.timestamp.outputs.date }}
|
tag_name: ${{ steps.timestamp.outputs.date }}
|
||||||
name: ${{ steps.timestamp.outputs.date }}
|
name: ${{ steps.timestamp.outputs.date }}
|
||||||
token: ${{ secrets.OWLBOT_KEY }}
|
token: ${{ secrets.OWLBOT_KEY }}
|
||||||
|
files: |
|
||||||
|
release-data.jsonl
|
||||||
|
|||||||
27
scripts/ndjson-out.js
Normal file
27
scripts/ndjson-out.js
Normal 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
0
scripts/test.yaml
Normal file
Reference in New Issue
Block a user