-
-
Notifications
You must be signed in to change notification settings - Fork 78
87 lines (73 loc) · 2.41 KB
/
dependency-check.yml
File metadata and controls
87 lines (73 loc) · 2.41 KB
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
name: Check for Yarn dependency updates
on:
schedule:
# Runs every 2 weeks (Monday at 00:00 UTC)
- cron: "0 0 */14 * *"
workflow_dispatch: # Optional: Allow manual trigger
permissions:
contents: write
issues: write
pull-requests: write
jobs:
dependency-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: "next-release"
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install scripts dependencies
run: |
cd .github/scripts
npm install
- name: Install project dependencies
run: yarn install
- name: Check for outdated dependencies
id: outdated
run: |
yarn outdated --json > outdated.json || true
- name: Determine if any dependencies are outdated
id: check_outdated
run: |
if [ -s outdated.json ]; then
echo "outdated=true" >> $GITHUB_ENV
else
echo "outdated=false" >> $GITHUB_ENV
fi
- name: Install project dependencies (docs)
run: cd docs_src && yarn install
- name: Check for outdated dependencies (docs)
id: outdated_docs
run: |
cd docs_src && yarn outdated --json > outdated_docs.json || true
- name: Determine if any dependencies are outdated
id: check_outdated_docs
run: |
if [ -s outdated_docs.json ]; then
echo "outdated=true" >> $GITHUB_ENV
fi
- name: Create branch and update dependencies
if: env.outdated == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b dependency-updates
yarn upgrade --latest
# yarn upgrade --latest --minor
# yarn upgrade --latest --patch
cd docs_src && yarn upgrade --latest
cd ..
git commit -am "chore: upgrade dependencies"
git push origin dependency-updates
- name: Create pull request linking to issue
if: env.outdated == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
node .github/scripts/create-pull-request.js