Skip to content

Commit

Permalink
Merge pull request #279 from City-of-Helsinki/dev
Browse files Browse the repository at this point in the history
Dev to main
  • Loading branch information
khalima authored Jan 31, 2024
2 parents 6cbe9ab + 526c1f3 commit 4ae36db
Show file tree
Hide file tree
Showing 46 changed files with 296 additions and 215 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/npm-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Npm audit

on:
workflow_dispatch:
schedule:
- cron: '0 12 * * 0' # Run every fortnight on Sunday at 12

jobs:
npm_audit:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run npm audit
id: npm_audit
run: |
find public/modules/custom public/themes/custom -type f -name ".nvmrc" -exec sh -c '
dir=$(dirname "$1")
node_version=$(cat "$1")
echo "Using Node.js version $node_version in $dir"
cd "$dir"
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install $node_version
nvm use $node_version
set +e
npm audit --package-lock-only --loglevel=error;
# The npm audit command will exit with a 0 exit code if no vulnerabilities were found.
if [ $? -gt 0 ]; then
npm audit fix --package-lock-only --loglevel=error;
if [ $? -gt 0 ]; then
echo "BC_BREAK=:exclamation: NPM Audit fix could not fix all vulnerabilities. Fix them manually by running \`npm audit fix --force\` and test the functionalities thoroughly as there might be breaking changes. :exclamation:" >> $GITHUB_ENV;
fi;
echo "CREATE_PR=true" >> $GITHUB_OUTPUT;
fi;
set -e
' sh {} \;
- name: Create Pull Request
if: steps.npm_audit.outputs.CREATE_PR == 'true'
uses: peter-evans/create-pull-request@v4
with:
committer: GitHub <[email protected]>
author: actions-bot <[email protected]>
commit-message: Updated node modules based on npm audit fix
title: Automatic npm audit fix
labels: auto-update
body: |
# Npm audit
${{ env.BC_BREAK }}
## How to install
* Update the HDBT theme
* `git fetch --all`
* `git checkout automation/npm-audit`
* `git pull origin automation/npm-audit`
* In the custom module or custom theme folder, run `nvm use && npm i && npm run build`
## How to test
Run `npm audit`
* [ ] Check that the `npm audit` prints `found 0 vulnerabilities`
* [ ] Check that the changes for distributed files are sensible
branch: automation/npm-audit
92 changes: 44 additions & 48 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
- media_library
- text
_core:
default_config_hash: xTZ_QboVaHSjUUn0bJd0FO1rW46IV5DgmCZDyQY2sqc
default_config_hash: JfX1NDmZllc_fHMeOSFBgWspFRoEEmivcXOUu014O-k
id: paragraph.chart.default
targetEntityType: paragraph
bundle: chart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- field.field.paragraph.content_liftup.field_content_liftup_unit
- paragraphs.paragraphs_type.content_liftup
_core:
default_config_hash: YJo-TIdvyPiJJX4wEnY5rLCoDcpAVZD4KftOr6BEyAI
default_config_hash: xULweJ9JMlJZPMLEKe6rT2QooMGsSyiqRMh9VCv95fM
id: paragraph.content_liftup.default
targetEntityType: paragraph
bundle: content_liftup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
- media_library
- text
_core:
default_config_hash: 8PkD28wd76Uxb7Lxrd8Js9613dKfCawFNWaoOv5PhF0
default_config_hash: 7crENIwhGW6tRoex4OmKX32kDMRWvLBJ-YjDSBifPak
id: paragraph.map.default
targetEntityType: paragraph
bundle: map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
module:
- text
_core:
default_config_hash: PW4d3mI32Txzxw6-lJRypROkivZ5BfDWMjLnABgARqA
default_config_hash: BOw_UiW-L7EQ8Y6D4E0CAMkB8XxXao5rBZzbq-DNbBI
id: paragraph.chart.default
targetEntityType: paragraph
bundle: chart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ content:
settings:
image_link: ''
image_style: 1_1_l
image_loading:
attribute: lazy
third_party_settings: { }
weight: 0
region: content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- field.field.paragraph.content_liftup.field_content_liftup_unit
- paragraphs.paragraphs_type.content_liftup
_core:
default_config_hash: ye6NcMF3kU9sj6VD5kRrFG_o9h2rbjfrVAWCO9MAFUE
default_config_hash: dPsp5m4FRvYce8_hXZJSdT2m-WOFaFpX1hOQw-mrgGE
id: paragraph.content_liftup.default
targetEntityType: paragraph
bundle: content_liftup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
module:
- text
_core:
default_config_hash: wmFqvJHZ4YBgQf6tWjN2zwr6sXyqoWGcv441cwJoQR0
default_config_hash: 9Mw4AexMhGVXoajYwrdAHrw7-66rs0sg3l0P7BVEaWo
id: paragraph.map.default
targetEntityType: paragraph
bundle: map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ langcode: en
status: true
dependencies: { }
_core:
default_config_hash: imFLQtHenUWCDEXySYBm0H7gJ55i3_AF8zALft8uiqo
default_config_hash: 3cezkDpNnpY89NCorCj-4mBIeItsVAEG803y-phaZTM
id: helfi_news
label: 'Helfi: News'
label_plural: 'Helfi: News'
Expand Down
Loading

0 comments on commit 4ae36db

Please sign in to comment.