Skip to content

Commit 644304b

Browse files
Merge pull request #64 from creative-commoners/pulls/2/allow-yarn
ENH Allow changes in yarn.lock on merge-up
2 parents 7ddc53b + cbdf401 commit 644304b

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

action.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,8 @@ runs:
163163
rm __compare.json
164164
165165
# Don't allow merge-ups when there are changes in javascript dependency files (e.g. package.json)
166-
# Note that yarn.lock is allowed to merge-up between minors only (not majors)
167-
# Its presence in a git diff will force a yarn build (assuming no merge-conflicts)
168-
# There is a check in a later step if it's a minor or major merge-up
166+
# Note that yarn.lock is allowed to merge-up between minors and majors. Its presence in a git diff
167+
# will force a yarn install and yarn build which will correctly resolve JS deps
169168
DEPENDENCY_FILES="package.json"
170169
for DEPENDENCY_FILE in $DEPENDENCY_FILES; do
171170
if [[ $(echo "$FILES" | grep $DEPENDENCY_FILE) != "" ]]; then
@@ -292,7 +291,7 @@ runs:
292291
# Determine if we will rebuild dist file during merge-up
293292
# This is based on:
294293
# - if there are changes in the client/ directory and if there's a package.json file, OR
295-
# - if there are changes in yarn.lock, though this is only allowed for minor-merge-ups
294+
# - if there are changes in yarn.lock
296295
REBUILD=0
297296
CLIENT_DIFF_FILES=$(git diff --name-only $INTO_BRANCH...$FROM_BRANCH | grep -P ^client/) || true
298297
echo "CLIENT_DIFF_FILES is:"
@@ -304,13 +303,7 @@ runs:
304303
YARN_LOCK_DIFF=$(git diff --name-only $INTO_BRANCH...$FROM_BRANCH | grep -P ^yarn\.lock$) || true
305304
echo "YARN_LOCK_DIFF is $YARN_LOCK_DIFF"
306305
if [[ $YARN_LOCK_DIFF != "" ]]; then
307-
if [[ $MERGE_UP_TYPE == "major" ]]; then
308-
echo "Changes in yarn.lock detected when doing major merge up from $FROM_BRANCH into $INTO_BRANCH. Aborting."
309-
exit 1
310-
else
311-
# Minor merge-up allows changes in yarn.lock, though there needs to be a rebuild
312-
REBUILD=1
313-
fi
306+
REBUILD=1
314307
fi
315308
echo "REBUILD is $REBUILD"
316309
@@ -320,9 +313,9 @@ runs:
320313
# We often expect a merge-conflict when there are client/dist file differences
321314
MERGE_RESULT=$(git merge --no-ff --no-commit $FROM_BRANCH || true)
322315
323-
# Only merge conflicts in client/dist are allowed, stop for all others, including yarn.lock
316+
# Only merge conflicts in client/dist and yarn.lock are allowed, stop for all others
324317
# See https://git-scm.com/docs/git-status#_output for information on the porcelain format
325-
UNMERGED_FILES=$(git status --porcelain=v1 | grep -P '^(DD|AU|UD|UA|DU|AA|UU)' | grep -v client/dist) || true
318+
UNMERGED_FILES=$(git status --porcelain=v1 | grep -P '^(DD|AU|UD|UA|DU|AA|UU)' | grep -v client/dist | grep -v yarn.lock) || true
326319
if [[ $UNMERGED_FILES != "" ]]; then
327320
echo "Merge conflict found when merging-up $FROM_BRANCH into $INTO_BRANCH. Aborting."
328321
# The following line needs to be quoted so that line breaks show
@@ -432,6 +425,9 @@ runs:
432425
fi
433426
434427
# Rebuild dist files.
428+
# `yarn install` will handle any merge conflicts in `yarn.lock`
429+
# It will effectively do a JS Deps upgrade as part of the merge-up and use the
430+
# most recent versions of deps allowable by package.json
435431
# Note that `yarn install` probably isn't required as the `build` script in package.json
436432
# for every module should include `yarn &&` which will do `yarn install`, though we include
437433
# it here just to be extra sure

0 commit comments

Comments
 (0)