Skip to content

Instantly share code, notes, and snippets.

@bedlaj
Created September 27, 2021 09:35
Show Gist options
  • Save bedlaj/a8f7d45217f1bf4d4626658a46883fc6 to your computer and use it in GitHub Desktop.
Save bedlaj/a8f7d45217f1bf4d4626658a46883fc6 to your computer and use it in GitHub Desktop.
Github workflow for npm-check-updates automated PR with daily updates of NPM dependencies. Example run https://github.com/bedlaj/sha512-crypt-ts/pull/17
name: NPM Check Updates
on:
workflow_dispatch:
schedule:
- cron: '0 7 * * *'
jobs:
ncu:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install ncu
run: |
npm install -g npm-check-updates
- name: Execute ncu
id: ncu
run: |
NCU_OUTPUT=$(ncu -u)
npm install
NCU_OUTPUT="${NCU_OUTPUT//'%'/'%25'}"
NCU_OUTPUT="${NCU_OUTPUT//$'\n'/'%0A'}"
NCU_OUTPUT="${NCU_OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=ncuOutput::$NCU_OUTPUT"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: 'Automated npm-check-updates'
body: |
🤖
```
${{ steps.ncu.outputs.ncuOutput }}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment