Squashed commit of the following:

commit 6cf6f9c3a23c4e193b5577c5d394f1907917be56
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:41:55 2024 -0400

    fix: update tracking

commit 9bb8292089d6689e4c2f1cff06a12062a1253333
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:38:22 2024 -0400

    Update worktree.ts

commit 6d0725ee1fda4693075ef3b94894ba2b5b8c67c5
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:36:04 2024 -0400

    Update worktree.ts

commit f24119c6ee0d5a1ad456b9a488027ad722ff68ba
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:32:45 2024 -0400

    Update worktree.ts

commit a93ccc90d20c86e02f03382e8571020277cb975f
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:30:49 2024 -0400

    Update worktree.ts

commit 422f948045898c857e455d269f4e80bf9cf3f6cb
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:28:54 2024 -0400

    Update worktree.ts

commit 84c87e3ecaf6ac7f021dd090b9db1eea9ddc395a
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:23:48 2024 -0400

    Update worktree.ts

commit 3b0b9cbdafb0429708c19982c9e70ce61d79df9f
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:16:43 2024 -0400

    Update build.yml

commit f1cf93b8e951499d7aa52483ff5ac18837702001
Author: James Ives <iam@jamesiv.es>
Date:   Sun Sep 29 11:11:58 2024 -0400

    Update worktree.ts
This commit is contained in:
James Ives
2024-09-29 11:42:16 -04:00
parent ff20230dee
commit ad7c547b7a
3 changed files with 33 additions and 22 deletions

View File

@@ -113,8 +113,7 @@ jobs:
- name: Tweak content to publish to existing branch
if: ${{ matrix.branch == 'gh-pages' }}
run: |
RANDOM_CHAR=$(echo $RANDOM | tr -dc 'a-zA-Z0-9' | fold -w 1 | head -n 1)
echo "<!-- just sayin $RANDOM_CHAR -->" >> integration/index.html
echo "<!-- just sayin -->" >> integration/index.html
- name: Deploy with modifications to existing branch
id: modified

View File

@@ -239,7 +239,7 @@ describe('git', () => {
await deploy(action)
// Includes the call to generateWorktree
expect(execute).toHaveBeenCalledTimes(13)
expect(execute).toHaveBeenCalledTimes(14)
expect(rmRF).toHaveBeenCalledTimes(1)
})

View File

@@ -100,14 +100,26 @@ export async function generateWorktree(
info(
'Error encountered while checking out branch. Attempting to continue with a new branch name.'
)
branchName = `temp-${Date.now()}`
checkout = new GitCheckout(branchName)
await execute(
checkout.toString(),
`${action.workspace}/${worktreedir}`,
action.silent
)
branchName = `temp-${Date.now()}`
try {
checkout = new GitCheckout(branchName, `origin/${action.branch}`)
await execute(
checkout.toString(),
`${action.workspace}/${worktreedir}`,
action.silent
)
} catch (error) {
info('Unable to track the origin branch…')
checkout = new GitCheckout(branchName)
await execute(
checkout.toString(),
`${action.workspace}/${worktreedir}`,
action.silent
)
}
}
if (!branchExists) {
@@ -128,19 +140,19 @@ export async function generateWorktree(
action.silent
)
}
}
/**
* Ensure that the workspace is a safe directory.
*/
try {
await execute(
`git config --global --add safe.directory "${action.workspace}/${worktreedir}"`,
action.workspace,
action.silent
)
} catch {
info('Unable to set worktree temp directory as a safe directory…')
}
/**
* Ensure that the workspace is a safe directory.
*/
try {
await execute(
`git config --global --add safe.directory "${action.workspace}/${worktreedir}"`,
action.workspace,
action.silent
)
} catch {
info('Unable to set worktree temp directory as a safe directory…')
}
} catch (error) {
throw new Error(