Skip to content

fix(deps): update dependency ejs to v3.1.7 [security] #3957

fix(deps): update dependency ejs to v3.1.7 [security]

fix(deps): update dependency ejs to v3.1.7 [security] #3957

name: CI - Test and Build
on:
workflow_dispatch:
pull_request:
branches: [ master ]
jobs:
get-changes-for-spas:
runs-on: ubuntu-latest
timeout-minutes: 20
# Outputs all changed files in a json format to start matrix jobs
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check changed files
id: changed-files
uses: tj-actions/[email protected]
with:
dir_names: true
json: true
- name: Get dir names
id: get-dir-names
uses: actions/github-script@v6
with:
script: |
const folders = JSON.parse("${{ steps.changed-files.outputs.all_changed_files }}");
const newArr = [];
for (let folder of folders) {
if (folder.startsWith('packages')) {
const folderNameParts = folder.split('/');
const folderName = `${folderNameParts[0]}/${folderNameParts[1]}`
if (!newArr.includes(folderName)) {
newArr.push(folderName)
}
}
}
core.setOutput('dir_names', JSON.stringify(JSON.stringify(newArr)))
- id: set-matrix
run: echo "matrix={\"container\":${{ steps.get-dir-names.outputs.dir_names }}}" >> "$GITHUB_OUTPUT"
matrix-job:
name: Job for ${{ matrix.container }}
timeout-minutes: 20
runs-on: ubuntu-latest
needs: [get-changes-for-spas]
strategy:
matrix: ${{ fromJSON(needs.get-changes-for-spas.outputs.matrix) }}
max-parallel: 4
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install node modules
run: |
cd ${{ matrix.container }}
npm install
- name: If its a SPA then copy .env
if: contains(matrix.container, '-spa')
run: |
cd ${{ matrix.container }}
cp .test.env .env
- name: Build package
run: |
cd ${{ matrix.container }}
npm run build
- name: Test package
run: |
cd ${{ matrix.container }}
npm run test