File tree 3 files changed +32
-21
lines changed
3 files changed +32
-21
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,7 @@ jobs:
113
113
- name : Tweak content to publish to existing branch
114
114
if : ${{ matrix.branch == 'gh-pages' }}
115
115
run : |
116
- RANDOM_CHAR=$(echo $RANDOM | tr -dc 'a-zA-Z0-9' | fold -w 1 | head -n 1)
117
- echo "<!-- just sayin $RANDOM_CHAR -->" >> integration/index.html
116
+ echo "<!-- just sayin -->" >> integration/index.html
118
117
119
118
- name : Deploy with modifications to existing branch
120
119
id : modified
Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ describe('git', () => {
239
239
await deploy ( action )
240
240
241
241
// Includes the call to generateWorktree
242
- expect ( execute ) . toHaveBeenCalledTimes ( 13 )
242
+ expect ( execute ) . toHaveBeenCalledTimes ( 14 )
243
243
expect ( rmRF ) . toHaveBeenCalledTimes ( 1 )
244
244
} )
245
245
Original file line number Diff line number Diff line change @@ -100,14 +100,26 @@ export async function generateWorktree(
100
100
info (
101
101
'Error encountered while checking out branch. Attempting to continue with a new branch name.'
102
102
)
103
+
103
104
branchName = `temp-${ Date . now ( ) } `
104
- checkout = new GitCheckout ( branchName )
105
105
106
- await execute (
107
- checkout . toString ( ) ,
108
- `${ action . workspace } /${ worktreedir } ` ,
109
- action . silent
110
- )
106
+ try {
107
+ checkout = new GitCheckout ( branchName , `origin/${ action . branch } ` )
108
+ await execute (
109
+ checkout . toString ( ) ,
110
+ `${ action . workspace } /${ worktreedir } ` ,
111
+ action . silent
112
+ )
113
+ } catch ( error ) {
114
+ info ( 'Unable to track the origin branch…' )
115
+
116
+ checkout = new GitCheckout ( branchName )
117
+ await execute (
118
+ checkout . toString ( ) ,
119
+ `${ action . workspace } /${ worktreedir } ` ,
120
+ action . silent
121
+ )
122
+ }
111
123
}
112
124
113
125
if ( ! branchExists ) {
@@ -128,19 +140,19 @@ export async function generateWorktree(
128
140
action . silent
129
141
)
130
142
}
143
+ }
131
144
132
- /**
133
- * Ensure that the workspace is a safe directory.
134
- */
135
- try {
136
- await execute (
137
- `git config --global --add safe.directory "${ action . workspace } /${ worktreedir } "` ,
138
- action . workspace ,
139
- action . silent
140
- )
141
- } catch {
142
- info ( 'Unable to set worktree temp directory as a safe directory…' )
143
- }
145
+ /**
146
+ * Ensure that the workspace is a safe directory.
147
+ */
148
+ try {
149
+ await execute (
150
+ `git config --global --add safe.directory "${ action . workspace } /${ worktreedir } "` ,
151
+ action . workspace ,
152
+ action . silent
153
+ )
154
+ } catch {
155
+ info ( 'Unable to set worktree temp directory as a safe directory…' )
144
156
}
145
157
} catch ( error ) {
146
158
throw new Error (
You can’t perform that action at this time.
0 commit comments