Skip to content

Commit c4b32ec

Browse files
author
Illia Obukhau
authored
[WC-1550]: Handle pnpm install failure in dependabot PRs (#183)
2 parents a423fd0 + 4cd8054 commit c4b32ec

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/Build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,27 @@ jobs:
6363
6464
- name: Install dependencies
6565
run: pnpm install
66+
# This step is meant to update pnpm-lock.yaml file on Dependabot
67+
# pull requests. Right now dependabot not work fine with monorepos
68+
# so we have to do extra work to automatically update lock file.
69+
# This step is part of "check" job, but could be part of any other job.
70+
# We put it here just because previous `Install dependencies` step is just
71+
# first "install" in this workflow.
72+
# The idea of this step - if install fails, try to fix lock file, commit and
73+
# push changes.
74+
# NOTE: we use magic string ([dependabot skip]) to allow branch rebase,
75+
# read more at link below
76+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/managing-pull-requests-for-dependency-updates#allowing-dependabot-to-rebase-and-force-push-over-extra-commits
77+
- name: Update pnpm-lock.yaml on Dependabot pull request
78+
if: ${{ failure() && github.actor == 'dependabot[bot]' }}
79+
# https://github.com/actions/checkout#push-a-commit-using-the-built-in-token
80+
run: |
81+
pnpm install --no-frozen-lockfile
82+
git config user.name github-actions
83+
git config user.email [email protected]
84+
git add pnpm-lock.yaml
85+
git commit -m "build: update pnpm-lock.yaml [dependabot skip]"
86+
git push
6687
- name: Lint code
6788
run: pnpm run lint ${{ needs.setup-options.outputs.since-flag }}
6889
- name: Run unit tests

0 commit comments

Comments
 (0)