Skip to content

Commit 9ccf385

Browse files
committed
Handle slashes in branch name
1 parent eb5f649 commit 9ccf385

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
# Setup variables
5959
BUILD_BRANCH="build/${GITHUB_REF_NAME}"
6060
GITHUB_ACTION_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}/checks"
61+
SAFE_BRANCH_NAME="${BUILD_BRANCH//\//-}"
62+
DIFF_FILE="${RUNNER_TEMP}/${SAFE_BRANCH_NAME}.diff"
6163
6264
# Switch branches... maybe?
6365
git fetch --all
@@ -71,12 +73,11 @@ jobs:
7173
fi
7274
7375
# Capture diff of the changes between the two branches
74-
git diff --no-color --binary --full-index ${BUILD_BRANCH} ${GITHUB_REF_NAME} > ~/${BUILD_BRANCH}.diff
76+
git diff --no-color --binary --full-index ${BUILD_BRANCH} ${GITHUB_REF_NAME} > "${DIFF_FILE}"
7577
76-
# If the diff file is not empty then continue
77-
if [ -s ~/${BUILD_BRANCH}.diff ]; then
78-
# Apply changes to the build branch
79-
git apply --index ~/${BUILD_BRANCH}.diff
78+
# If there are changes, apply & push
79+
if [ -s "${DIFF_FILE}" ]; then
80+
git apply --index "${DIFF_FILE}"
8081
8182
# Add file changes and commit
8283
git add .

0 commit comments

Comments
 (0)