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