Remote error, ref to long
Closed this issue · 2 comments
Describe the bug
After pushing a new global workflows, some of my repo's return an error. Probably because of the name of the branch is to long.
Error message:
Failed replicating files for this repo: Error: To https://github.com/Repo/myrepo.git
! refs/heads/bot/update-global-workflow-bot/update-global-workflow-bot/update-global-workflow-bot/update-global-workflow-development-7e406d73ec9a7186cefd53b3ad73474d65a4798c-e634deb9ee65ee64f91499c89035e6837fe20856-1e59f6ebbbde64affd03ca679a59eb222b10229d-139af083aa31cfb9f7483f8266014cb9ea1f62c0:refs/heads/bot/update-global-workflow-bot/update-global-workflow-bot/update-global-workflow-bot/update-global-workflow-development-7e406d73ec9a7186cefd53b3ad73474d65a4798c-e634deb9ee65ee64f91499c89035e6837fe20856-1e59f6ebbbde64affd03ca679a59eb222b10229d-139af083aa31cfb9f7483f8266014cb9ea1f62c0 [remote rejected] (pre-receive hook declined)
Done
Pushing to https://github.com/Repo/myrepo.git
POST git-receive-pack (3471 bytes)
remote: error: GH005: Sorry, refs longer than 255 bytes are not allowed.
remote: ref too long: "refs/heads/bot/update-global-workflow-bot/update-global-workflow-bot/update-global-workflow-bot/update-global-workflow-development-7e406d73ec9a7186cefd53b3ad73474d65a4798c-e634deb9ee65ee64f91499c89035e6837fe20856-1e59f6ebbbde64affd03ca679a59eb222b10229d-139af083aa31cfb9f7483f8266014cb9ea1f62c0"
error: failed to push some refs to 'https://github.com/Repo/myrepo.git'
How to Reproduce
I'm not sure how to reproduce this exactly, it happens on a few target repo's. In most repo's the PR is created succesfully.
This is my workflow config:
name: Copy global workflows
on:
push:
branches: [ "master" ]
jobs:
replicate_changes:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Replicating global workflow
uses: derberg/copy-files-to-other-repositories@v1.0.3
with:
branches: development
github_token: ${{ secrets.TOKEN }}
patterns_to_ignore: ".github/workflows/global_workflow_copy.yml"
patterns_to_include: ".github/workflows"
topics_to_include: "global-workflow"
exclude_private: false
exclude_forked: true
commit_message: "CI: Update global workflows"
Expected behavior
A PR is created in the target repo, no errors.
I had a similar issue, when I first started using this action. See: #39 (comment)
If you want it to match development
branches exactly, you would use this ^development$
instead, otherwise it will match any branch that has the name development
in it, and that will likely cause the workflow to create PRs on top of branches it created previously.
I had a similar issue, when I first started using this action. See: #39 (comment)
If you want it to match
development
branches exactly, you would use this^development$
instead, otherwise it will match any branch that has the namedevelopment
in it, and that will likely cause the workflow to create PRs on top of branches it created previously.
Great, that's it! I didn't notice that the branches value was a regex all the time.