From ff20230deef023e9c51970348365b821371aa108 Mon Sep 17 00:00:00 2001 From: James Ives Date: Sun, 29 Sep 2024 10:55:01 -0400 Subject: [PATCH] fix: resolve 'origin/gh-pages' is not a commit and a branch cannot be created from it error (#1702) * fix: orphan branch issue * Update worktree.ts * Update worktree.ts * Update worktree.ts * Update worktree.ts * Update build.yml * Update build.yml * Update build.yml * Update build.yml --- .github/workflows/build.yml | 10 ++-------- src/worktree.ts | 3 +-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4dcc8676f..a3398dfa9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,13 +68,6 @@ jobs: lib node_modules - - name: Cleanup Generated Branches - uses: dawidd6/action-delete-branch@v3.1.0 - continue-on-error: true - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branches: gh-pages - integration: runs-on: ubuntu-latest needs: build @@ -120,7 +113,8 @@ jobs: - name: Tweak content to publish to existing branch if: ${{ matrix.branch == 'gh-pages' }} run: | - echo "" >> integration/index.html + RANDOM_CHAR=$(echo $RANDOM | tr -dc 'a-zA-Z0-9' | fold -w 1 | head -n 1) + echo "" >> integration/index.html - name: Deploy with modifications to existing branch id: modified diff --git a/src/worktree.ts b/src/worktree.ts index 7a7589cd0..ec94670c6 100644 --- a/src/worktree.ts +++ b/src/worktree.ts @@ -101,8 +101,7 @@ export async function generateWorktree( 'Error encountered while checking out branch. Attempting to continue with a new branch name.' ) branchName = `temp-${Date.now()}` - checkout.orphan = true - checkout = new GitCheckout(branchName, `origin/${action.branch}`) + checkout = new GitCheckout(branchName) await execute( checkout.toString(),