Skip to content

Commit

Permalink
fix: resolve 'origin/gh-pages' is not a commit and a branch cannot be…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
JamesIves authored Sep 29, 2024
1 parent b06fcc8 commit ff20230
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -120,7 +113,8 @@ jobs:
- name: Tweak content to publish to existing branch
if: ${{ matrix.branch == 'gh-pages' }}
run: |
echo "<!-- just sayin -->" >> integration/index.html
RANDOM_CHAR=$(echo $RANDOM | tr -dc 'a-zA-Z0-9' | fold -w 1 | head -n 1)
echo "<!-- just sayin $RANDOM_CHAR -->" >> integration/index.html
- name: Deploy with modifications to existing branch
id: modified
Expand Down
3 changes: 1 addition & 2 deletions src/worktree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit ff20230

Please # to comment.