Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 11, 2025

Description

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.

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'

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
  • .github/copilot-instructions.md: Added Copilot instructions file with comprehensive repository guidelines, development practices, testing patterns, and deployment flow documentation

Testing Instructions

  1. Run the test suite: yarn test - All 60 tests should pass including the new test that validates temporary branch names use hyphens
  2. Build the project: yarn build - Should complete without errors
  3. Run linting: yarn lint - Should pass without issues
  4. Verify the new Copilot instructions file provides useful context for development

Additional Notes

This minimal change resolves the Git reference conflict without affecting any other functionality or breaking existing workflows. The addition of Copilot instructions will help improve future development and contributions to the repository.


✨ 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 AI and others added 2 commits September 11, 2025 01:10
Co-authored-by: JamesIves <10888441+JamesIves@users.noreply.github.com>
Co-authored-by: JamesIves <10888441+JamesIves@users.noreply.github.com>
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 AI requested a review from JamesIves September 11, 2025 01:16
@JamesIves
Copy link
Owner

@copilot update this

Co-authored-by: JamesIves <10888441+JamesIves@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 10, 2025

@copilot update this

Created .github/copilot-instructions.md with comprehensive repository guidelines covering architecture, development practices, testing, and deployment flow. Commit: 126bfd9

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.

2 participants