Compare commits
8 Commits
a407c252bf
...
20260221_1
| Author | SHA1 | Date | |
|---|---|---|---|
| f08a579246 | |||
| adb538cbc4 | |||
| d00eb5cf6c | |||
| 247a997353 | |||
| cc14397588 | |||
| d058ba8eed | |||
| 36243c7457 | |||
| 1969e90394 |
@@ -9,7 +9,7 @@ on:
|
|||||||
- pis-*
|
- pis-*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate_and_release:
|
validate_and_PR:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -27,6 +27,7 @@ jobs:
|
|||||||
run: node ./scripts/merge-yaml.js
|
run: node ./scripts/merge-yaml.js
|
||||||
|
|
||||||
- name: Commit Changes
|
- name: Commit Changes
|
||||||
|
id: commit
|
||||||
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
|
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: Sort & Merge PIS Files
|
commit_message: Sort & Merge PIS Files
|
||||||
|
|||||||
@@ -20,6 +20,21 @@ 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"
|
||||||
|
pwd
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
if: success()
|
if: success()
|
||||||
uses: akkuman/gitea-release-action@v1
|
uses: akkuman/gitea-release-action@v1
|
||||||
@@ -30,3 +45,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: |-
|
||||||
|
pis-objects.jsonl
|
||||||
|
|||||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
package-lock.json
|
||||||
@@ -1835,12 +1835,6 @@ pis:
|
|||||||
- code: "5351"
|
- code: "5351"
|
||||||
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,egg,umb,bnp]
|
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,egg,umb,bnp]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
- code: "5351"
|
|
||||||
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,egg,umb,bnp]
|
|
||||||
toc: "gw"
|
|
||||||
- code: "5352"
|
|
||||||
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,lap,egg,kgn,pma,umb,cpn,bnp]
|
|
||||||
toc: "gw"
|
|
||||||
- code: "5352"
|
- code: "5352"
|
||||||
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,lap,egg,kgn,pma,umb,cpn,bnp]
|
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,lap,egg,kgn,pma,umb,cpn,bnp]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
@@ -1931,9 +1925,6 @@ pis:
|
|||||||
- code: "5381"
|
- code: "5381"
|
||||||
stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,ext,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
|
stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,ext,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
- code: "5381"
|
|
||||||
stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,ext,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
|
|
||||||
toc: "gw"
|
|
||||||
- code: "5382"
|
- code: "5382"
|
||||||
stops: [exm,lym,top,nco,dig,exc,exd,dwl,tgm,nta,trr,tqy,pgn]
|
stops: [exm,lym,top,nco,dig,exc,exd,dwl,tgm,nta,trr,tqy,pgn]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
@@ -3857,9 +3848,6 @@ pis:
|
|||||||
- code: "6051"
|
- code: "6051"
|
||||||
stops: [exc,exd,ntc,cdi,oke]
|
stops: [exc,exd,ntc,cdi,oke]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
- code: "6051"
|
|
||||||
stops: [exc,exd,ntc,cdi,oke]
|
|
||||||
toc: "gw"
|
|
||||||
- code: "6052"
|
- code: "6052"
|
||||||
stops: [exd,cdi,oke]
|
stops: [exd,cdi,oke]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
@@ -4202,9 +4190,6 @@ pis:
|
|||||||
- code: "6182"
|
- code: "6182"
|
||||||
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
|
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
- code: "6182"
|
|
||||||
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
|
|
||||||
toc: "gw"
|
|
||||||
- code: "6183"
|
- code: "6183"
|
||||||
stops: [pgn,tqy,trr,nta,tgm,dwl,dww,scs,mbt,ext,exd,exc,dig,nco,top,lym,exm]
|
stops: [pgn,tqy,trr,nta,tgm,dwl,dww,scs,mbt,ext,exd,exc,dig,nco,top,lym,exm]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
@@ -4415,9 +4400,6 @@ pis:
|
|||||||
- code: "6293"
|
- code: "6293"
|
||||||
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dwl,tgm,nta,trr,tqy,pgn]
|
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dwl,tgm,nta,trr,tqy,pgn]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
- code: "6293"
|
|
||||||
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dwl,tgm,nta,trr,tqy,pgn]
|
|
||||||
toc: "gw"
|
|
||||||
- code: "6294"
|
- code: "6294"
|
||||||
stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,dwl,tgm,nta,trr,tqy,pgn]
|
stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,dwl,tgm,nta,trr,tqy,pgn]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
@@ -4622,6 +4604,9 @@ pis:
|
|||||||
- code: "6384"
|
- code: "6384"
|
||||||
stops: [bri,lwh,srd,asd,fit]
|
stops: [bri,lwh,srd,asd,fit]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
|
- code: "6404"
|
||||||
|
stops: [cdf,nwp,fit,bri,bth,boa,tro,wsb,wmn,sal]
|
||||||
|
toc: "gw"
|
||||||
- code: "6406"
|
- code: "6406"
|
||||||
stops: [pmh,pms,ftn,csa,frm,sou]
|
stops: [pmh,pms,ftn,csa,frm,sou]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
@@ -4637,6 +4622,9 @@ pis:
|
|||||||
- code: "6413"
|
- code: "6413"
|
||||||
stops: [exm,lym,lyc,exn,top,dig,pol,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
|
stops: [exm,lym,lyc,exn,top,dig,pol,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
|
- code: "6417"
|
||||||
|
stops: [sal,wmn,wsb,tro,boa,brh,bri,fit,stj,nwp,cdf]
|
||||||
|
toc: "gw"
|
||||||
- code: "6418"
|
- code: "6418"
|
||||||
stops: [cdf,nwp,fit,bri,bth,boa,tro,wsb,wmn]
|
stops: [cdf,nwp,fit,bri,bth,boa,tro,wsb,wmn]
|
||||||
toc: "gw"
|
toc: "gw"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs');
|
||||||
const yaml = require('yaml')
|
const yaml = require('yaml');
|
||||||
|
|
||||||
const directoryPath = './pis/'
|
const directoryPath = './pis/';
|
||||||
|
|
||||||
function sortAndMergeYAMLFiles() {
|
function sortAndMergeYAMLFiles() {
|
||||||
try {
|
try {
|
||||||
@@ -12,15 +12,15 @@ function sortAndMergeYAMLFiles() {
|
|||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
const data = fs.readFileSync(directoryPath + file, 'utf-8');
|
const data = fs.readFileSync(directoryPath + file, 'utf-8');
|
||||||
|
|
||||||
const parsedData = yaml.parse(data)
|
const parsedData = yaml.parse(data);
|
||||||
|
|
||||||
if (parsedData && typeof parsedData === 'object' && parsedData.pis) {
|
if (parsedData && typeof parsedData === 'object' && parsedData.pis) {
|
||||||
mergedData.push(...parsedData.pis)
|
mergedData.push(...parsedData.pis);
|
||||||
} else {
|
} else {
|
||||||
if (Array.isArray(parsedData)) {
|
if (Array.isArray(parsedData)) {
|
||||||
mergedData.push(...parsedData);
|
mergedData.push(...parsedData);
|
||||||
} else {
|
} else {
|
||||||
console.error("Incorrect YAML")
|
console.error("Incorrect YAML");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -29,7 +29,7 @@ function sortAndMergeYAMLFiles() {
|
|||||||
const codeA = parseInt(a.code);
|
const codeA = parseInt(a.code);
|
||||||
const codeB = parseInt(b.code);
|
const codeB = parseInt(b.code);
|
||||||
return codeA - codeB
|
return codeA - codeB
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -41,27 +41,26 @@ function sortAndMergeYAMLFiles() {
|
|||||||
seenCodes.add(item.code);
|
seenCodes.add(item.code);
|
||||||
outputString += ` - code: "${item.code}"\n`;
|
outputString += ` - code: "${item.code}"\n`;
|
||||||
outputString += ` stops: [${item.stops.map(stop => `${stop}`).join(',')}]\n`;
|
outputString += ` stops: [${item.stops.map(stop => `${stop}`).join(',')}]\n`;
|
||||||
outputString += ` toc: "${item.toc || "gw"}"\n`;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync('./pis/codes.yaml', outputString);
|
fs.writeFileSync('./pis/codes.yaml', outputString);
|
||||||
console.log("Overwritten codes.yaml")
|
console.log("Overwritten codes.yaml");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error writing codes.yaml", err)
|
console.error("Error writing codes.yaml", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any files created by dgp2
|
// Remove any new files
|
||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
if (file.startsWith('auto-')) {
|
if (file !== 'codes.yaml') {
|
||||||
fs.unlinkSync(directoryPath + file);
|
fs.unlinkSync(directoryPath + file);
|
||||||
console.log(`Deleted file: ${file}`);
|
console.log(`Deleted file: ${file}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error('Error merging YAML:', err)
|
console.error('Error merging YAML:', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
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.parse(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