Skip to content

Commit

Permalink
fix(ci): Escape ` from JSON metadata files.
Browse files Browse the repository at this point in the history
  • Loading branch information
petejohanson committed Jan 5, 2023
1 parent c23443a commit 5b9b507
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- ".github/workflows/build.yml"
- "app/**"
schedule:
- cron: '22 4 * * *'
- cron: "22 4 * * *"

jobs:
build:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: "14.x"
- name: Install @actions/artifact
run: npm install @actions/artifact
- name: Build and upload artifacts
Expand All @@ -64,7 +64,7 @@ jobs:
const artifactClient = artifact.create();
const execSync = require('child_process').execSync;
const buildShieldArgs = JSON.parse(`${{ matrix.shieldArgs }}`);
let error = false;
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
const coreCoverage = `${{ needs.core-coverage.outputs.core-include }}` || "[]";
const boardChanges = `${{ needs.board-changes.outputs.boards-include }}` || "[]";
const nightly = `${{ needs.nightly.outputs.nightly-include }}` || "[]";
const combined = [
...JSON.parse(coreCoverage),
...JSON.parse(boardChanges),
Expand Down Expand Up @@ -148,14 +148,14 @@ jobs:
runs-on: ubuntu-latest
needs: get-changed-files
outputs:
core-include: ${{ steps.core-list.outputs.result }}
core-include: ${{ steps.core-list.outputs.result }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: "14.x"
- name: Install js-yaml
run: npm install js-yaml
- uses: actions/github-script@v4
Expand All @@ -166,7 +166,7 @@ jobs:
const yaml = require('js-yaml');
const coreCoverage = yaml.load(fs.readFileSync('app/core-coverage.yml', 'utf8'));
let include = coreCoverage.board.flatMap(board =>
coreCoverage.shield.map(shield => ({ board, shield }))
);
Expand All @@ -184,7 +184,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: "14.x"
- name: Install js-yaml
run: npm install js-yaml
- uses: actions/github-script@v4
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
with:
script: |
const metadata = JSON.parse(`${{ needs.get-grouped-hardware.outputs.organized-metadata }}`);
let includeOnboard = metadata.onboard.flatMap(b => {
if (b.siblings) {
return b.siblings.map(board => ({
Expand Down Expand Up @@ -311,7 +311,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: "14.x"
- name: Install js-yaml
run: npm install js-yaml
- name: Aggregate Metadata
Expand All @@ -329,7 +329,7 @@ jobs:
yaml.loadAll(fs.readFileSync(f, "utf8"))
);
return JSON.stringify(aggregated).replace(/\\/g,"\\\\");
return JSON.stringify(aggregated).replace(/\\/g,"\\\\").replace(/`/g,"\\`");
result-encoding: string

- name: Organize Metadata
Expand Down Expand Up @@ -389,7 +389,7 @@ jobs:
- uses: Ana06/get-changed-files@v2.0.0
id: changed-files
with:
format: 'json'
format: "json"
- uses: actions/github-script@v4
id: board-changes
with:
Expand Down

0 comments on commit 5b9b507

Please sign in to comment.