Skip to content

Commit

Permalink
Merge pull request #630 from edoardopirovano/enable-dependabot
Browse files Browse the repository at this point in the history
Enable dependabot automatic updates
  • Loading branch information
edoardopirovano authored Jul 26, 2021
2 parents 36f860f + 554f1b3 commit 2f3ec1f
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 11 deletions.
9 changes: 9 additions & 0 deletions .github/depandabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "thursday" # Gives us a working day to merge this before our typical release
labels:
- "Update dependencies"
2 changes: 1 addition & 1 deletion .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: .github/workflows/script/check-js.sh

check-node-modules:
runs-on: ubuntu-latest
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/script/check-node-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if [ ! -z "$(git status --porcelain)" ]; then
>&2 echo "Failed: Repo should be clean before testing!"
exit 1
fi
sudo npm install --force -g npm@latest
# Reinstall modules and then clean to remove absolute paths
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
npm ci
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Update dependencies
on:
pull_request_target:
types: [opened, synchronize, reopened, labeled]

jobs:
update:
name: Update dependencies
runs-on: macos-latest
if: contains(github.event.pull_request.labels.*.name, 'Update dependencies')
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Remove PR label
env:
REPOSITORY: '${{ github.repository }}'
PR_NUMBER: '${{ github.event.pull_request.number }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE
- name: Push updated dependencies
env:
BRANCH: '${{ github.head_ref }}'
run: |
git fetch
git checkout $BRANCH
sudo npm install --force -g npm@latest
npm install
npm ci
npm run removeNPMAbsolutePaths
if [ ! -z "$(git status --porcelain)" ]; then
git config --global user.email "[email protected]"
git config --global user.name "github-actions[bot]"
git add node_modules
git commit -am "Update checked-in dependencies"
git push origin "$BRANCH"
fi
6 changes: 1 addition & 5 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2f3ec1f

Please sign in to comment.