93 lines (89 loc) · 2.97 KB
/
cspell5-update-dependencies.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: 🧊 CSpell5 - Update Dependencies
on:
push:
branches:
- cspell5
paths:
- "**/package.json"
- "**/package-lock.json"
workflow_dispatch:
inputs:
updateSnapshots:
description: "Update Integration Test snapshots (yes/no)"
default: "no"
required: false
# schedule:
# - cron: "0 12 * * 0"
permissions:
contents: read
jobs:
update-dependencies:
if: github.repository_owner == 'streetsidesoftware'
runs-on: ubuntu-latest
env:
NEW_BRANCH: "cspell5-update-dependencies"
REF_BRANCH: cspell5
UPDATE_SNAPSHOTS: ${{ github.event.inputs.updateSnapshots == 'yes' || github.event.inputs.updateSnapshots == 'y' }}
steps:
- name: Start
run: |
echo "${{ toJson(github.event.inputs) }}"
echo "Update Snapshots: $UPDATE_SNAPSHOTS"
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ env.REF_BRANCH }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: npm
- name: Setup NPM
run: npm i -g npm@8
- name: Update Root
run: |
npm i
npx npm-check-updates -t minor -u
rm -rf node_modules package-lock.json
- name: Install
run: npm install
- name: Update packages
run: |
npm run update-packages
- name: Build
if: env.UPDATE_SNAPSHOTS == 'true'
run: |
npm run build
- name: Update Integration Test Snapshots
if: env.UPDATE_SNAPSHOTS == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run update-snapshots
- name: Has changes
run: |
git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV
git --no-pager diff --compact-summary
- name: Gen Body
run: |
echo 'git_body<<DIFF' >> $GITHUB_ENV
git --no-pager diff --compact-summary >> $GITHUB_ENV
echo 'DIFF' >> $GITHUB_ENV
- name: Echo git_status
run: echo "${{ env.git_status }}"
- uses: tibdex/github-app-token@f717b5ecd4534d3c4df4ce9b5c1c2214f0f7cd06 # v1.5 # cspell:ignore tibdex
if: env.git_status == 'dirty'
id: generate-token
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- name: Create Pull Request
if: env.git_status == 'dirty'
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4
with:
commit-message: "ci: Workflow Bot -- Update ALL Dependencies"
branch: ${{ env.NEW_BRANCH }}
base: ${{ env.REF_BRANCH }}
title: "ci: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})"
token: ${{ steps.generate-token.outputs.token }}
body: ${{ env.git_body }}
delete-branch: true