Skip to content

Commit 2f3ec1f

Browse files
Merge pull request #630 from edoardopirovano/enable-dependabot
Enable dependabot automatic updates
2 parents 36f860f + 554f1b3 commit 2f3ec1f

File tree

6 files changed

+52
-11
lines changed

6 files changed

+52
-11
lines changed

.github/depandabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
day: "thursday" # Gives us a working day to merge this before our typical release
8+
labels:
9+
- "Update dependencies"

.github/workflows/pr-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: .github/workflows/script/check-js.sh
2828

2929
check-node-modules:
30-
runs-on: ubuntu-latest
30+
runs-on: macos-latest
3131

3232
steps:
3333
- uses: actions/checkout@v2

.github/workflows/script/check-node-modules.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ if [ ! -z "$(git status --porcelain)" ]; then
77
>&2 echo "Failed: Repo should be clean before testing!"
88
exit 1
99
fi
10+
sudo npm install --force -g npm@latest
1011
# Reinstall modules and then clean to remove absolute paths
1112
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
1213
npm ci
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Update dependencies
2+
on:
3+
pull_request_target:
4+
types: [opened, synchronize, reopened, labeled]
5+
6+
jobs:
7+
update:
8+
name: Update dependencies
9+
runs-on: macos-latest
10+
if: contains(github.event.pull_request.labels.*.name, 'Update dependencies')
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
15+
- name: Remove PR label
16+
env:
17+
REPOSITORY: '${{ github.repository }}'
18+
PR_NUMBER: '${{ github.event.pull_request.number }}'
19+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
20+
run: |
21+
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE
22+
23+
- name: Push updated dependencies
24+
env:
25+
BRANCH: '${{ github.head_ref }}'
26+
run: |
27+
git fetch
28+
git checkout $BRANCH
29+
sudo npm install --force -g npm@latest
30+
npm install
31+
npm ci
32+
npm run removeNPMAbsolutePaths
33+
if [ ! -z "$(git status --porcelain)" ]; then
34+
git config --global user.email "github-actions@github.com"
35+
git config --global user.name "github-actions[bot]"
36+
git add node_modules
37+
git commit -am "Update checked-in dependencies"
38+
git push origin "$BRANCH"
39+
fi

node_modules/.package-lock.json

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)