Dependencies #483
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dependencies | |
on: | |
schedule: | |
- cron: '0 9 * * 1-5' | |
workflow_dispatch: | |
jobs: | |
audit: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 16.x ] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Audit dependencies | |
id: audit | |
run: | | |
minor_changes=$(npm run deps:lint:minor) | |
minor_changes="${minor_changes//'%'/'%25'}" | |
minor_changes="${minor_changes//$'\n'/'%0A'}" | |
minor_changes="${minor_changes//$'\r'/'%0D'}" | |
echo ::set-output name=minor_changes::$minor_changes | |
npm run deps:upgrade:minor | |
npm install | |
major_changes=$(npm run deps:lint) | |
major_changes="${major_changes//'%'/'%25'}" | |
major_changes="${major_changes//$'\n'/'%0A'}" | |
major_changes="${major_changes//$'\r'/'%0D'}" | |
echo ::set-output name=major_changes::$major_changes | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: "Dependency Audit" | |
commit-message: "chore(deps): update dependencies to latest minor versions" | |
body: | | |
Minor version changes applied: | |
``` | |
${{ steps.audit.outputs.minor_changes }} | |
``` | |
Major version changes still outstanding: | |
``` | |
${{ steps.audit.outputs.major_changes }} | |
``` | |
branch: chore/dependency-audit |