Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Always merge-up commits even if files are identical #40

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,18 @@ runs:
# when running a failed job though that's still a valid scenario
git checkout $FROM_BRANCH
git pull
FROM_BRANCH_SHA=$(git rev-parse HEAD)
echo "FROM_BRANCH $FROM_BRANCH sha is $FROM_BRANCH_SHA"
git checkout $INTO_BRANCH
git pull
INTO_BRANCH_SHA=$(git rev-parse HEAD)
echo "INTO_BRANCH $INTO_BRANCH sha is $INTO_BRANCH_SHA"

# If both branches are on the same sha, there's nothing to do
if [[ $FROM_BRANCH_SHA == $INTO_BRANCH_SHA ]]; then
echo "FROM_BRANCH $FROM_BRANCH and INTO_BRANCH $INTO_BRANCH have the same sha. Skipping."
continue
fi

# Determine if we will rebuild dist file during merge-up
# This is based simply on if there are changes in the client/ directory and if there's a package.json file
Expand All @@ -254,7 +264,7 @@ runs:
# `|| true is suffixed to the command to prevent the job from stopping on merge conflict
# This is because git will sent a non-zero exit code when there is a merge conflict
# We often expect a merge-conflict when there are client/dist file differences
git merge --no-ff --no-commit $FROM_BRANCH || true
MERGE_RESULT=$(git merge --no-ff --no-commit $FROM_BRANCH || true)

# Only merge conflicts in client/dist are allowed, stop for all others
# See https://git-scm.com/docs/git-status#_output for information on the porcelain format
Expand Down Expand Up @@ -377,9 +387,9 @@ runs:
exit 1
fi

# Continue if there's nothing to commit
if [[ $GIT_STATUS == "" ]]; then
echo "No changes found when merging-up $FROM_BRANCH into $INTO_BRANCH. Skipping."
# Things are update to up to date, so do not commit
if [[ $MERGE_RESULT =~ "Already up to date" ]]; then
echo "Merge result said things are already up to date when merging-up $FROM_BRANCH into $INTO_BRANCH. Skipping."
continue
fi

Expand Down
Loading