Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix temporaryDeploymentBranch conflict by replacing slash with hyphen#1892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge3 commits intodev
base:dev
Choose a base branch
Loading
fromcopilot/fix-1712
Draft
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions__tests__/git.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -469,5 +469,35 @@ describe('git', () => {
expect(execute).toHaveBeenCalledTimes(17)
expect(response).toBe(Status.SUCCESS)
})

it('should generate temporary branch name without forward slashes to avoid conflicts', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'assets',
branch: 'branch',
token: '123',
repositoryName: 'JamesIves/montezuma',
pusher: {
name: 'asd',
email: 'as@cat'
},
isTest: TestFlag.HAS_CHANGED_FILES
})

await deploy(action)

// Check that execute was called with a checkout command that doesn't contain forward slashes in branch name
const executeCalls = (execute as jest.Mock).mock.calls
const checkoutCall = executeCalls.find((call) =>
call[0].includes('checkout -b') && call[0].includes('github-pages-deploy-action')
)

expect(checkoutCall).toBeDefined()
// The branch name should contain 'github-pages-deploy-action-' (with hyphen, not slash)
expect(checkoutCall[0]).toMatch(/github-pages-deploy-action-[a-z0-9]+/)
// The branch name should NOT contain forward slashes
expect(checkoutCall[0]).not.toMatch(/github-pages-deploy-action\//)
})
})
})
2 changes: 1 addition & 1 deletionsrc/git.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,7 +108,7 @@ export async function init(action: ActionInterface): Promise<void | Error> {
export async function deploy(action: ActionInterface): Promise<Status> {
const temporaryDeploymentDirectory =
'github-pages-deploy-action-temp-deployment-folder'
const temporaryDeploymentBranch = `github-pages-deploy-action/${Math.random()
const temporaryDeploymentBranch = `github-pages-deploy-action-${Math.random()
.toString(36)
.substr(2, 9)}`
const rsyncVersion = getRsyncVersion()
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp