-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (62 loc) · 2.54 KB
/
dependency-update.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
name: Dependency Update
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
jobs:
upgrade-dependencies:
runs-on: ubuntu-20.04
env:
deps_branch_name: dep-update
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
fetch-depth: 0
# We deliberately do not use the setup action, as we do not want node caching here.
- name: Configure direnv
uses: HatsuneMiku3939/direnv-action@v1
- name: Install Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Upgrade all node dependencies
id: upgrade
run: |
lockfiles=(`find . -name "yarn.lock" ! -path '*/node_modules/*'`)
for i in "${lockfiles[@]}"
do
yarn --cwd "${i%/*}" upgrade
done
if [ "$(git status --porcelain)" ]; then
echo "::set-output name=changes::true"
fi
- name: Commit code to deps branch
if: ${{ steps.upgrade.outputs.changes }}
run: |
git config user.name github-actions
git config user.email [email protected]
git branch -D $deps_branch_name || true
git checkout -b $deps_branch_name
git commit -a -m "chore(deps): Upgrade all node dependencies"
git push --set-upstream origin $deps_branch_name --force
- name: Slack Notification - notify of failure
uses: rtCamp/action-slack-notify@v2
if: env.SLACK_WEBHOOK != '' && failure()
env:
SLACK_COLOR: ${{job.status}}
SLACK_ICON: https://github.com/${{ github.repository_owner }}.png?size=48
SLACK_TITLE: Failure
SLACK_USERNAME: ${{ github.repository }} ${{job.status}}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Slack Notification - notify of success
uses: rtCamp/action-slack-notify@v2
if: env.SLACK_WEBHOOK != ''
env:
SLACK_COLOR: ${{job.status}}
SLACK_ICON: https://github.com/${{ github.repository_owner }}.png?size=48
SLACK_TITLE: Update Dependencies Workflow - SUCCESS
SLACK_MESSAGE: Click https://github.com/${{ github.repository }}/compare/master...${{ env.deps_branch_name }}?quick_pull=1&labels=deps&title=chore(deps):+Update+Dependencies&body=Update+all+dependencies. to create a PR for the updates to go to master.
SLACK_USERNAME: ${{ github.repository }} ${{job.status}}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}