We can do this!!!
This commit is contained in:
parent
3efb7b533e
commit
15893c0d07
|
@ -16,7 +16,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
|
@ -40,13 +40,19 @@ jobs:
|
|||
push_options: '--force'
|
||||
|
||||
- name: Checkout main branch
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'main'
|
||||
path: 'main'
|
||||
|
||||
|
||||
- name: Checkout Docs branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'Docs'
|
||||
path: 'Docs'
|
||||
|
||||
- name: Checkout gh-pages branch
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'gh-pages'
|
||||
path: 'gh-pages'
|
||||
|
@ -54,6 +60,8 @@ jobs:
|
|||
- name: Copy samples.json to gh-pages branch
|
||||
run: cp main/samples.json gh-pages/samples.json
|
||||
|
||||
- name: Copy samples.json to Docs branch
|
||||
run: cp main/samples.json Docs/samples.json
|
||||
|
||||
- name: Commit to gh-pages branch
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
|
@ -61,4 +69,12 @@ jobs:
|
|||
commit_message: 'Update samples.json'
|
||||
branch: 'gh-pages'
|
||||
file_pattern: samples.json
|
||||
push_options: '--force'
|
||||
|
||||
- name: Commit to Docs branch
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: 'Update samples.json'
|
||||
branch: 'Docs'
|
||||
file_pattern: samples.json
|
||||
push_options: '--force'
|
|
@ -21,14 +21,16 @@ directories.forEach(directory => {
|
|||
files.forEach(file => {
|
||||
if (file === 'sample.json') {
|
||||
const data = JSON.parse(fs.readFileSync(path.join(assetsPath, file), 'utf8'));
|
||||
// Assuming data is an array of nodes, concatenate it to the mergedNodes array
|
||||
mergedNodes = mergedNodes.concat(data);
|
||||
// Assuming data is an array of nodes, merge it into the mergedNodes array
|
||||
Array.prototype.push.apply(mergedNodes, data);
|
||||
// Or using spread operator
|
||||
// mergedNodes.push(...data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Write the merged nodes to a new JSON file
|
||||
fs.writeFileSync('samples.json', JSON.stringify(mergedNodes, null, 2));
|
||||
fs.writeFileSync('sample.json', JSON.stringify(mergedNodes, null, 2));
|
||||
|
||||
console.log('Merged nodes saved to samples.json');
|
||||
console.log('Merged nodes saved to samples_merged.json');
|
||||
|
|
Loading…
Reference in New Issue