Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 11, 2025

This PR fixes a Git reference conflict that occurs when creating temporary deployment branches. The action was failing when a branch named github-pages-deploy-action already exists in the repository.

Problem

The action creates temporary branches using the pattern:

github-pages-deploy-action/{random-string}

When a branch named github-pages-deploy-action already exists, Git cannot create the temporary branch because it interprets branch names with forward slashes as nested references. This causes the error:

fatal: cannot lock ref 'refs/heads/github-pages-deploy-action/sh2ajsxux': 'refs/heads/github-pages-deploy-action' exists; cannot create 'refs/heads/github-pages-deploy-action/sh2ajsxux'

Solution

Changed the temporary branch naming pattern from:

`github-pages-deploy-action/${randomString}`

To:

`github-pages-deploy-action-${randomString}`

This uses a hyphen separator instead of a forward slash, eliminating the Git reference conflict while maintaining a clear naming convention.

Changes Made

  • src/git.ts: Modified line 111 to use hyphen instead of forward slash in temporaryDeploymentBranch
  • tests/git.test.ts: Added test case to validate branch name format and prevent regression

Testing

  • All existing tests pass (60/60)
  • New test validates that temporary branch names use hyphens and don't contain forward slashes
  • Build and linting pass without issues

This minimal change resolves the conflict without affecting any other functionality or breaking existing workflows.

Fixes #1712.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Contributor Author

Copilot AI commented Sep 11, 2025

@JamesIves 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@Copilot Copilot AI changed the title [WIP] bug: 🐝 fail if there is github-pages-deploy-action branch due to conflict temporaryDeploymentBranch Fix temporaryDeploymentBranch conflict by replacing slash with hyphen Sep 11, 2025
@Copilot Copilot AI requested a review from JamesIves September 11, 2025 01:16
Copilot finished work on behalf of JamesIves September 11, 2025 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: 🐝 fail if there is github-pages-deploy-action branch due to conflict temporaryDeploymentBranch
2 participants