Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

fix issue where new repo didn't set matching source branch #87

Merged
merged 1 commit into from
Jun 15, 2021
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
8 changes: 7 additions & 1 deletion bin/storybook_to_ghpages
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ if (args.DRY_RUN) {
shell.cd(args.OUTPUT_DIR);
publishUtils.exec('git init');

// if --source-branch specified, it needs to exist in the new repo too
const { SOURCE_BRANCH } = args;
if (!!SOURCE_BRANCH) {
publishUtils.exec(`git checkout -b ${SOURCE_BRANCH}`);
}

// inside this git repo we'll pretend to be a new user
publishUtils.exec(`git config user.name ${JSON.stringify(config.gitUsername)}`);
publishUtils.exec(`git config user.email ${JSON.stringify(config.gitEmail)}`);
Expand All @@ -64,7 +70,7 @@ if (args.CI_DEPLOY) {
}
}

const { SOURCE_BRANCH, TARGET_BRANCH } = args;
const { TARGET_BRANCH } = args;

publishUtils.exec(
`git push --force --quiet ${GIT_URL} ${SOURCE_BRANCH}:${TARGET_BRANCH}`
Expand Down