Skip to content

Commit fb1eb73

Browse files
committed
Merge branch 'dev' into releases/v4
2 parents 56d4ca7 + ff20230 commit fb1eb73

File tree

7 files changed

+67
-28
lines changed

7 files changed

+67
-28
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ jobs:
113113
- name: Tweak content to publish to existing branch
114114
if: ${{ matrix.branch == 'gh-pages' }}
115115
run: |
116-
echo "<!-- just sayin -->" >> integration/index.html
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
117118
118119
- name: Deploy with modifications to existing branch
119120
id: modified

.github/workflows/integration.yml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
name: Integration Tests 🧪
22
on:
3+
workflow_call:
34
workflow_dispatch:
4-
inputs:
5-
branch:
6-
description: 'Specifies the branch which the integration tests should run on.'
7-
required: true
8-
default: 'releases/v4'
95
schedule:
106
- cron: 30 15 * * 0-6
11-
push:
12-
tags-ignore:
13-
- '*.*'
14-
branches:
15-
- releases/v4
167

178
jobs:
18-
# Deploys cross repo with an access token.
199
integration-cross-repo-push:
2010
container: node:16.13
2111
runs-on: ubuntu-latest
@@ -40,7 +30,6 @@ jobs:
4030
clean: true
4131
silent: true
4232

43-
# Deploys using checkout@v1 with an ACCESS_TOKEN.
4433
integration-checkout-v1:
4534
needs: integration-cross-repo-push
4635
runs-on: ubuntu-latest
@@ -62,8 +51,8 @@ jobs:
6251
uses: dawidd6/[email protected]
6352
with:
6453
github_token: ${{ secrets.GITHUB_TOKEN }}
54+
branches: gh-pages
6555

66-
# Deploys using checkout@v2 with a GITHUB_TOKEN.
6756
integration-checkout-v2:
6857
needs: integration-checkout-v1
6958
runs-on: ubuntu-latest
@@ -86,6 +75,7 @@ jobs:
8675
uses: dawidd6/[email protected]
8776
with:
8877
github_token: ${{ secrets.GITHUB_TOKEN }}
78+
branches: gh-pages
8979

9080
# Deploys using a container that requires you to install rsync.
9181
integration-container:
@@ -340,3 +330,32 @@ jobs:
340330
owner: MontezumaIves
341331
repository: lab
342332
branches: gh-pages
333+
334+
integration-root-folder:
335+
needs: integration-rebase-conflicts-cleanup
336+
runs-on: ubuntu-latest
337+
steps:
338+
- name: Checkout
339+
uses: actions/checkout@v4
340+
with:
341+
persist-credentials: false
342+
343+
- name: Echo
344+
working-directory: integration
345+
run: |
346+
echo "Here"
347+
348+
- name: Build and Deploy
349+
uses: JamesIves/github-pages-deploy-action@v4
350+
with:
351+
folder: .
352+
target-folder: cat/montezuma5
353+
silent: true
354+
git-config-name: Montezuma
355+
git-config-email: [email protected]
356+
357+
- name: Cleanup Generated Branch
358+
uses: dawidd6/[email protected]
359+
with:
360+
github_token: ${{ secrets.GITHUB_TOKEN }}
361+
branches: gh-pages

.github/workflows/version.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ jobs:
1212
steps:
1313
- uses: nowactions/[email protected]
1414

15+
call-integration-workflow:
16+
name: Verify Major Tag 🚀
17+
needs: update-majorver
18+
uses: ./.github/workflows/integration.yml
19+
1520
update-registries:
21+
needs: call-integration-workflow
1622
name: Publish to Registries 📦
1723
runs-on: ubuntu-latest
1824
steps:

__tests__/git.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ describe('git', () => {
167167
const response = await deploy(action)
168168

169169
// Includes the call to generateWorktree
170-
expect(execute).toHaveBeenCalledTimes(14)
170+
expect(execute).toHaveBeenCalledTimes(15)
171171
expect(rmRF).toHaveBeenCalledTimes(1)
172172
expect(response).toBe(Status.SUCCESS)
173173
})
@@ -190,7 +190,7 @@ describe('git', () => {
190190
const response = await deploy(action)
191191

192192
// Includes the call to generateWorktree
193-
expect(execute).toHaveBeenCalledTimes(13)
193+
expect(execute).toHaveBeenCalledTimes(14)
194194
expect(rmRF).toHaveBeenCalledTimes(1)
195195
expect(response).toBe(Status.SUCCESS)
196196
})
@@ -215,7 +215,7 @@ describe('git', () => {
215215
await deploy(action)
216216

217217
// Includes the call to generateWorktree
218-
expect(execute).toHaveBeenCalledTimes(14)
218+
expect(execute).toHaveBeenCalledTimes(15)
219219
expect(rmRF).toHaveBeenCalledTimes(1)
220220
})
221221

@@ -264,7 +264,7 @@ describe('git', () => {
264264
await deploy(action)
265265

266266
// Includes the call to generateWorktree
267-
expect(execute).toHaveBeenCalledTimes(13)
267+
expect(execute).toHaveBeenCalledTimes(14)
268268
expect(rmRF).toHaveBeenCalledTimes(1)
269269
})
270270

@@ -295,7 +295,7 @@ describe('git', () => {
295295
const response = await deploy(action)
296296

297297
// Includes the call to generateWorktree
298-
expect(execute).toHaveBeenCalledTimes(14)
298+
expect(execute).toHaveBeenCalledTimes(15)
299299
expect(rmRF).toHaveBeenCalledTimes(1)
300300
expect(fs.existsSync).toHaveBeenCalledTimes(2)
301301
expect(response).toBe(Status.SUCCESS)
@@ -327,7 +327,7 @@ describe('git', () => {
327327
await deploy(action)
328328

329329
// Includes the call to generateWorktree
330-
expect(execute).toHaveBeenCalledTimes(11)
330+
expect(execute).toHaveBeenCalledTimes(12)
331331
expect(rmRF).toHaveBeenCalledTimes(1)
332332
})
333333
})
@@ -352,7 +352,7 @@ describe('git', () => {
352352
await deploy(action)
353353

354354
// Includes the call to generateWorktree
355-
expect(execute).toHaveBeenCalledTimes(11)
355+
expect(execute).toHaveBeenCalledTimes(12)
356356
expect(rmRF).toHaveBeenCalledTimes(1)
357357
})
358358

@@ -372,7 +372,7 @@ describe('git', () => {
372372

373373
await deploy(action)
374374

375-
expect(execute).toHaveBeenCalledTimes(11)
375+
expect(execute).toHaveBeenCalledTimes(12)
376376
expect(rmRF).toHaveBeenCalledTimes(1)
377377
expect(mkdirP).toHaveBeenCalledTimes(1)
378378
})
@@ -392,7 +392,7 @@ describe('git', () => {
392392
})
393393

394394
const response = await deploy(action)
395-
expect(execute).toHaveBeenCalledTimes(11)
395+
expect(execute).toHaveBeenCalledTimes(12)
396396
expect(rmRF).toHaveBeenCalledTimes(1)
397397
expect(response).toBe(Status.SKIPPED)
398398
})
@@ -466,7 +466,7 @@ describe('git', () => {
466466
})
467467

468468
const response = await deploy(action)
469-
expect(execute).toHaveBeenCalledTimes(16)
469+
expect(execute).toHaveBeenCalledTimes(17)
470470
expect(response).toBe(Status.SUCCESS)
471471
})
472472
})

__tests__/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('main', () => {
5353
debug: true
5454
})
5555
await run(action)
56-
expect(execute).toHaveBeenCalledTimes(18)
56+
expect(execute).toHaveBeenCalledTimes(19)
5757
expect(rmRF).toHaveBeenCalledTimes(1)
5858
expect(exportVariable).toHaveBeenCalledTimes(1)
5959
})
@@ -73,7 +73,7 @@ describe('main', () => {
7373
isTest: TestFlag.HAS_CHANGED_FILES
7474
})
7575
await run(action)
76-
expect(execute).toHaveBeenCalledTimes(21)
76+
expect(execute).toHaveBeenCalledTimes(22)
7777
expect(rmRF).toHaveBeenCalledTimes(1)
7878
expect(exportVariable).toHaveBeenCalledTimes(1)
7979
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@jamesives/github-pages-deploy-action",
33
"description": "GitHub action for building a project and deploying it to GitHub pages.",
44
"author": "James Ives <[email protected]> (https://jamesiv.es)",
5-
"version": "4.6.5",
5+
"version": "4.6.7",
66
"license": "MIT",
77
"main": "lib/lib.js",
88
"types": "lib/lib.d.ts",

src/worktree.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export async function generateWorktree(
101101
'Error encountered while checking out branch. Attempting to continue with a new branch name.'
102102
)
103103
branchName = `temp-${Date.now()}`
104-
checkout = new GitCheckout(branchName, `origin/${action.branch}`)
104+
checkout = new GitCheckout(branchName)
105105

106106
await execute(
107107
checkout.toString(),
@@ -128,6 +128,19 @@ export async function generateWorktree(
128128
action.silent
129129
)
130130
}
131+
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+
}
131144
}
132145
} catch (error) {
133146
throw new Error(

0 commit comments

Comments
 (0)