ci: autofix Dependabot commits (#2394)

* ci: autofix Dependabot commits

* Add git push

* Update dependabot.js.yml

* Update dependabot.js.yml
This commit is contained in:
ylemkimon
2020-08-10 08:41:16 +09:00
committed by GitHub
parent 4edc5b176d
commit dcd97aa0c2

41
.github/workflows/dependabot.js.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Dependabot
on:
push:
branches: [ dependabot/npm_and_yarn/** ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Autofix lockfile
run: |
# restore yarn.lock from the previous commit
git checkout HEAD^ -- yarn.lock
# install yarn-plugin-deduplicate
yarn plugin import https://raw.githubusercontent.com/eps1lon/yarn-plugin-deduplicate/latest/bin/%40yarnpkg/plugin-deduplicate.js
# if package.json was not updated, upgrade the dependency
git diff --name-only HEAD^ HEAD | grep -q 'package.json' || yarn up `git log -1 --pretty=%s | awk '{ print $3 }'`
# restore package.json from the last commit
git checkout HEAD -- package.json
yarn install
# deduplicate lockfile
yarn deduplicate
- name: Commit changes
run: |
git add yarn.lock
git config --global user.name 'dependabot[bot]'
git config --global user.email '49699333+dependabot[bot]@users.noreply.github.com'
git commit -m "Dependabot autofix [skip netlify]"
git push