Monorepo: update post-merge hook - make instalaltion conditional. (#50254)

If the merged changes are unrelated to dependency management and Composer/PNPM manifests, do not refresh dependencies.
This commit is contained in:
Vladimir Reznichenko 2024-08-02 11:08:54 +02:00 committed by GitHub
parent 83b12d59ee
commit 1440d26bf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,10 @@
#!/bin/sh
#!/usr/bin/env bash
. "$(dirname "$0")/_/husky.sh"
changedManifests=$( ( git diff --name-only HEAD ORIG_HEAD | grep -E '(package.json|pnpm-lock.yaml|pnpm-workspace.yaml|composer.json|composer.lock)$' ) || echo '' )
if [ -n "$changedManifests" ]; then
printf "It was a change in the following file(s) - refreshing dependencies:\n"
printf " %s\n" $changedManifests
pnpm install --frozen-lockfile
fi