npm-check-updates #37
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: npm-check-updates | |
on: | |
schedule: | |
- cron: 0 0 1 * * | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Versions | |
run: | | |
node --version | |
npm --version | |
- run: npm install -g npm-check-updates | |
- run: ncu -u | |
- run: npm install | |
- run: npm audit fix | |
- run: npm run build | |
- run: npm run format | |
# - run: npm run lint | |
- run: npm run package | |
# - run: npm test | |
- name: Diff | |
id: diff | |
run: | | |
git add -N . | |
git diff --name-only --exit-code | |
continue-on-error: true | |
- name: Commit & Push | |
run: | | |
set -x | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git switch -C npm-check-updates | |
git add . | |
git commit -m 'npm-check-updates' | |
git push --force --set-upstream origin npm-check-updates | |
if: steps.diff.outcome == 'failure' | |
- id: generate_token | |
uses: tibdex/github-app-token@v2.1.0 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Create PR | |
run: | | |
set -x | |
if [ $(gh pr list --base ${GITHUB_REF_NAME} --head npm-check-updates | wc -l) -eq 0 ]; then | |
gh pr create --base ${GITHUB_REF_NAME} --head npm-check-updates --title 'npm-check-updates' --body '' --label dependencies --assignee ${GITHUB_ACTOR} | |
fi | |
env: | |
GH_TOKEN: ${{ steps.generate_token.outputs.token }} | |
if: steps.diff.outcome == 'failure' |