Skip to content

Commit 69d79eb

Browse files
committed
Merge branch 'dev' into releases/v4
2 parents 9d877ee + e59bc65 commit 69d79eb

7 files changed

Lines changed: 42 additions & 295 deletions

File tree

.github/workflows/integration.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
1717
- name: Checkout
1818
uses: actions/checkout@v6.0.1
19+
with:
20+
persist-credentials: false
1921

2022
- name: Build and Deploy
2123
uses: JamesIves/github-pages-deploy-action@v4
@@ -36,6 +38,8 @@ jobs:
3638
steps:
3739
- name: Checkout
3840
uses: actions/checkout@v6.0.1
41+
with:
42+
persist-credentials: false
3943

4044
- name: Build and Deploy
4145
uses: JamesIves/github-pages-deploy-action@v4
@@ -281,6 +285,8 @@ jobs:
281285
steps:
282286
- name: Checkout
283287
uses: actions/checkout@v6.0.1
288+
with:
289+
persist-credentials: false
284290

285291
- name: Create random file
286292
run: echo $RANDOM > integration/1
@@ -303,6 +309,8 @@ jobs:
303309
steps:
304310
- name: Checkout
305311
uses: actions/checkout@v6.0.1
312+
with:
313+
persist-credentials: false
306314

307315
- name: Create random file
308316
run: echo $RANDOM > integration/2

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
runs-on: ubuntu-latest
4646
steps:
4747
- name: Checkout 🛎️
48-
uses: actions/checkout@v4
48+
uses: actions/checkout@v6
4949

5050
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
5151
run: |
@@ -99,22 +99,22 @@ By default, the action does not need any token configuration and uses the provid
9999

100100
#### Optional Choices
101101

102-
| Key | Value Information | Type | Required |
103-
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
104-
| `branch` | This is the branch you wish to deploy to, for example, `gh-pages` or `docs`. Defaults to `gh-pages`. | `with` | **No** |
105-
| `git-config-name` | Allows you to customize the name that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the name in the GitHub context, followed by the name of the action. | `with` | **No** |
106-
| `git-config-email` | Allows you to customize the email that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the email in the GitHub context, followed by a generic noreply GitHub email. You can include `<>` for the value if you wish to omit this field altogether and push the commits without an email. | `with` | **No** |
107-
| `repository-name` | Allows you to specify a different repository path so long as you have permissions to push to it. This should be formatted like so: `JamesIves/github-pages-deploy-action`. You'll need to use a PAT in the `token` input for this configuration option to work properly. | `with` | **No** |
108-
| `target-folder` | If you'd like to push the contents of the deployment folder into a specific directory on the deployment branch you can specify it here. | `with` | **No** |
109-
| `commit-message` | If you need to customize the commit message for an integration you can do so. | `with` | **No** |
110-
| `clean` | You can use this option to delete files from your deployment destination that no longer exist in your deployment source. One use case is if your project generates hashed files that vary from build to build. Using `clean` will not affect `.git`, `.github`, or `.ssh` directories. This option is turned on by default and can be toggled off by setting it to `false`. | `with` | **No** |
111-
| `clean-exclude` | If you need to use `clean` but you'd like to preserve certain files or folders you can use this option. This should contain each pattern as a single line in a multiline string. | `with` | **No** |
112-
| `dry-run` | Do not actually push back, but use `--dry-run` on `git push` invocations instead. | `with` | **No** |
113-
| `single-commit` | This option can be toggled to `true` if you'd prefer to have a single commit on the deployment branch instead of maintaining the full history. **Using this option will also cause any existing history to be wiped from the deployment branch**. | `with` | **No** |
114-
| `force` | Force-push new deployments to overwrite the previous version; otherwise, attempt to rebase new deployments onto any existing ones. This option is turned on by default and can be toggled off by setting it to `false`, which may be useful if there are multiple deployments in a single branch. | `with` | **No** |
115-
| `attempt-limit` | How many rebase attempts to make before suspending the job. This option defaults to `3` and may be useful to increase when there are multiple deployments in a single branch. | `with` | **No** |
116-
| `silent` | Silences the action output preventing it from displaying git messages. | `with` | **No** |
117-
| `tag` | Add a tag to the commit. Only works when `dry-run` is not used. | `with` | **No** |
102+
| Key | Value Information | Type | Required |
103+
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
104+
| `branch` | This is the branch you wish to deploy to, for example, `gh-pages` or `docs`. Defaults to `gh-pages`. | `with` | **No** |
105+
| `git-config-name` | Allows you to customize the name that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the name in the GitHub context, followed by the name of the action. | `with` | **No** |
106+
| `git-config-email` | Allows you to customize the email that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the email in the GitHub context, followed by a generic noreply GitHub email. You can include `<>` for the value if you wish to omit this field altogether and push the commits without an email. | `with` | **No** |
107+
| `repository-name` | Allows you to specify a different repository path so long as you have permissions to push to it. This should be formatted like so: `JamesIves/github-pages-deploy-action`. You'll need to use a PAT in the `token` input for this configuration option to work properly. **When using `actions/checkout`, you must also set `persist-credentials: false` in the checkout step to prevent authentication conflicts.** | `with` | **No** |
108+
| `target-folder` | If you'd like to push the contents of the deployment folder into a specific directory on the deployment branch you can specify it here. | `with` | **No** |
109+
| `commit-message` | If you need to customize the commit message for an integration you can do so. | `with` | **No** |
110+
| `clean` | You can use this option to delete files from your deployment destination that no longer exist in your deployment source. One use case is if your project generates hashed files that vary from build to build. Using `clean` will not affect `.git`, `.github`, or `.ssh` directories. This option is turned on by default and can be toggled off by setting it to `false`. | `with` | **No** |
111+
| `clean-exclude` | If you need to use `clean` but you'd like to preserve certain files or folders you can use this option. This should contain each pattern as a single line in a multiline string. | `with` | **No** |
112+
| `dry-run` | Do not actually push back, but use `--dry-run` on `git push` invocations instead. | `with` | **No** |
113+
| `single-commit` | This option can be toggled to `true` if you'd prefer to have a single commit on the deployment branch instead of maintaining the full history. **Using this option will also cause any existing history to be wiped from the deployment branch**. | `with` | **No** |
114+
| `force` | Force-push new deployments to overwrite the previous version; otherwise, attempt to rebase new deployments onto any existing ones. This option is turned on by default and can be toggled off by setting it to `false`, which may be useful if there are multiple deployments in a single branch. | `with` | **No** |
115+
| `attempt-limit` | How many rebase attempts to make before suspending the job. This option defaults to `3` and may be useful to increase when there are multiple deployments in a single branch. | `with` | **No** |
116+
| `silent` | Silences the action output preventing it from displaying git messages. | `with` | **No** |
117+
| `tag` | Add a tag to the commit. Only works when `dry-run` is not used. | `with` | **No** |
118118

119119
With the action correctly configured you should see the workflow trigger the deployment under the configured conditions.
120120

@@ -167,7 +167,7 @@ jobs:
167167
runs-on: ubuntu-latest
168168
steps:
169169
- name: Checkout 🛎️
170-
uses: actions/checkout@v4
170+
uses: actions/checkout@v6
171171
172172
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
173173
run: |
@@ -217,7 +217,7 @@ jobs:
217217
runs-on: windows-latest # The first job utilizes windows-latest
218218
steps:
219219
- name: Checkout 🛎️
220-
uses: actions/checkout@v4
220+
uses: actions/checkout@v6
221221
222222
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
223223
run: |
@@ -236,7 +236,7 @@ jobs:
236236
runs-on: ubuntu-latest
237237
steps:
238238
- name: Checkout 🛎️
239-
uses: actions/checkout@v4
239+
uses: actions/checkout@v6
240240
241241
- name: Download Artifacts 🔻 # The built project is downloaded into the 'site' folder.
242242
uses: actions/download-artifact@v1
@@ -290,7 +290,7 @@ jobs:
290290
runs-on: ubuntu-latest
291291
steps:
292292
- name: Checkout 🛎️
293-
uses: actions/checkout@v4
293+
uses: actions/checkout@v6
294294
295295
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
296296
run: |

__tests__/git.test.ts

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('git', () => {
5454
})
5555

5656
await init(action)
57-
expect(execute).toHaveBeenCalledTimes(9)
57+
expect(execute).toHaveBeenCalledTimes(7)
5858
})
5959

6060
it('should catch when a function throws an error', async () => {
@@ -101,7 +101,7 @@ describe('git', () => {
101101
})
102102

103103
await init(action)
104-
expect(execute).toHaveBeenCalledTimes(9)
104+
expect(execute).toHaveBeenCalledTimes(7)
105105
})
106106

107107
it('should not unset git config if a user is using ssh', async () => {
@@ -144,55 +144,7 @@ describe('git', () => {
144144
})
145145

146146
await init(action)
147-
expect(execute).toHaveBeenCalledTimes(9)
148-
})
149-
150-
it('should remove includeIf git config sections when present', async () => {
151-
// Mock execute to return includeIf config entries
152-
;(execute as jest.Mock)
153-
.mockImplementationOnce(() => {
154-
// First call: git config safe.directory
155-
return {stdout: '', stderr: ''}
156-
})
157-
.mockImplementationOnce(() => ({stdout: '', stderr: ''})) // user.name
158-
.mockImplementationOnce(() => ({stdout: '', stderr: ''})) // user.email
159-
.mockImplementationOnce(() => ({stdout: '', stderr: ''})) // core.ignorecase
160-
.mockImplementationOnce(() => ({stdout: '', stderr: ''})) // unset extraheader
161-
.mockImplementationOnce(() => {
162-
// git config --local --get-regexp includeIf - simulate checkout@v6 style config
163-
return {
164-
stdout:
165-
'includeIf.gitdir:/home/runner/work/repo/.git.path /home/runner/work/_temp/git-credentials-123.config\n',
166-
stderr: ''
167-
}
168-
})
169-
.mockImplementationOnce(() => ({stdout: '', stderr: ''})) // remove-section includeIf --local
170-
.mockImplementationOnce(() => ({stdout: '', stderr: ''})) // git config --global --get-regexp includeIf
171-
.mockImplementationOnce(() => ({stdout: '', stderr: ''})) // git remote rm
172-
.mockImplementationOnce(() => ({stdout: '', stderr: ''})) // git remote add
173-
174-
Object.assign(action, {
175-
hostname: 'github.com',
176-
silent: false,
177-
repositoryPath: 'JamesIves/github-pages-deploy-action',
178-
token: '123',
179-
branch: 'branch',
180-
folder: '.',
181-
pusher: {
182-
name: 'asd',
183-
email: 'as@cat'
184-
},
185-
isTest: TestFlag.HAS_CHANGED_FILES
186-
})
187-
188-
await init(action)
189-
190-
// Verify that git config --remove-section was called for includeIf in both scopes
191-
expect(execute).toHaveBeenCalledWith(
192-
expect.stringContaining('git config --local --remove-section'),
193-
action.workspace,
194-
true
195-
)
147+
expect(execute).toHaveBeenCalledTimes(7)
196148
})
197149
})
198150

__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(21)
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(24)
76+
expect(execute).toHaveBeenCalledTimes(22)
7777
expect(rmRF).toHaveBeenCalledTimes(1)
7878
expect(exportVariable).toHaveBeenCalledTimes(1)
7979
})

0 commit comments

Comments
 (0)