BetaHuhn/repo-file-sync-action

Invalid PR branch when used in repos with a leading dot

jezdez opened this issue ยท 6 comments

๐Ÿž Describe the bug

When trying to use the action from a repo whose name starts with a dot like .github (community health files), it fails with git errors when it tries to create the PR branch:

Error: Error: Command failed: git checkout -b "repo-sync/.github/default"
fatal: 'repo-sync/.github/default' is not a valid branch name.

๐Ÿ“š To Reproduce

Use the action in a repo whose name wouldn't be a valid Git branch.

๐Ÿ’ก Expected behavior

Invalid characters in names should be filtered out.

๐Ÿ–ผ๏ธ Screenshots

If applicable, add screenshots to help explain your problem.

โš™๏ธ Environment

  • Action version: v.1.5.0

๐Ÿ“‹ Additional context

Alternatively it would be great to be able to specify the name of the branch, or the branch suffix.

Hey, thanks for creating the Issue!

This is definitely a problem which needs to be fixed.

Alternatively it would be great to be able to specify the name of the branch, or the branch suffix.

That seems to be the easiest solution and might be useful for other requirements as well. I will add an option to specify a custom branch prefix instead of the repo-sync/REPO_NAME.

I will start working on this tomorrow.

I implemented this on the develop branch.

You can try it out by using the action like this:

uses: BetaHuhn/repo-file-sync-action@develop
with:
    GH_PAT: ${{ secrets.GH_PAT }}
    BRANCH_PREFIX: custom-branch

I also added an example to the README which shows how you can use the BRANCH_PREFIX option.

@jezdez Let me know if this resolves your issue and I will merge this into master and release a new version.

Friendly ping @jezdez

Woops, sorry forgot to submit the form! Yep that did the trick, thank you :)

No problem! ๐Ÿ˜„

๐ŸŽ‰ This issue is resolved in version v1.6.0 ๐ŸŽ‰

To use the latest version, use the Action with the v1 tag:

uses: BetaHuhn/repo-file-sync-action@v1

Or the latest tag:

uses: BetaHuhn/repo-file-sync-action@latest