-
-
Notifications
You must be signed in to change notification settings - Fork 103
130 lines (110 loc) · 3.52 KB
/
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: ' 🔗 Update Dependencies'
on:
push:
branches:
- main
paths:
- '**/package.json'
- '*-lock.yaml'
workflow_dispatch:
inputs:
updateSnapshots:
description: 'Update Integration Test snapshots (yes/no)'
type: choice
options:
- 'yes'
- 'no'
default: 'no'
required: true
schedule:
- cron: '0 12 * * 0'
permissions:
contents: read
env:
NEW_BRANCH: 'update-dependencies-main'
REF_BRANCH: main
patch_path: patch.diff
patch_artifact: patch
jobs:
update-dependencies:
if: github.repository_owner == 'streetsidesoftware'
runs-on: ubuntu-latest
outputs:
patch_artifact: ${{ env.patch_artifact }}
patch_path: ${{ env.patch_path }}
base: ${{ env.REF_BRANCH }}
body: |
## Update ALL Dependencies (${{ env.REF_BRANCH }})
commit-message: 'ci: Workflow Bot -- Update ALL Dependencies'
branch: ${{ env.NEW_BRANCH }}
title: 'ci: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})'
env:
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@v4
with:
ref: ${{ env.REF_BRANCH }}
- name: Enable Corepack
run: corepack enable
- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
- name: Update Root
run: |
pnpm up
pnpm -r up
- name: Install
run: pnpm install
- name: Update Yarn
run: |
pnpm run update-yarn
- 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: Build
if: (env.UPDATE_SNAPSHOTS == 'true' || env.git_status == 'dirty')
run: |
pnpm run build
- name: Apply and new Lint rules
if: env.git_status == 'dirty'
continue-on-error: true
run: pnpm run lint
- name: Update Integration Test Snapshots
if: env.UPDATE_SNAPSHOTS == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pnpm run update-integration-snapshots
- name: Build Patch
run: |
mkdir temp || echo temp already exists
git add .
git diff HEAD > temp/${{ env.patch_path }}
- name: Store Patch
uses: actions/upload-artifact@v4
with:
name: ${{ env.patch_artifact }}
path: temp/${{ env.patch_path }}
retention-days: 1
pr:
uses: ./.github/workflows/reuseable-pr-from-artifact.yml
needs:
- update-dependencies
with:
patch_artifact: ${{ needs.update-dependencies.outputs.patch_artifact }}
patch_path: ${{ needs.update-dependencies.outputs.patch_path }}
base: ${{ needs.update-dependencies.outputs.base }}
body: ${{ needs.update-dependencies.outputs.body }}
commit-message: ${{ needs.update-dependencies.outputs.commit-message }}
branch: ${{ needs.update-dependencies.outputs.branch }}
title: ${{ needs.update-dependencies.outputs.title }}
secrets:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}