Dependabot-core: Provide option to configure format of branch name

Created on 27 Apr 2018  路  6Comments  路  Source: dependabot/dependabot-core

_From @edkellena on January 9, 2018 15:40_

Hey,
It would be super awesome if we could specify some format for the branch name created.

Use-case:
Our CI system sees a PR raised and will run through a build process that generates a Docker image and tags it with the branch name. Unfortunately Docker tags have more limited scope than Git branches...
A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.

The / in the Dependabot branches is causing that tagging to fail. We can work around this with some awk/shell wizardry I guess, but would be nice not to have to do this.

_Copied from original issue: dependabot/feedback#72_

Most helpful comment

Is it still a problem to implement? We have exactly the same issue

All 6 comments

Thanks for the feedback @edkellena.

It's a totally legit request, but I'm not keen on changing things on Dependabot's side for a couple of reasons:

  • branch name generation is already quite complicated and I don't want to add more considerations to it
  • there's no obvious place to put the setting in the frontend at the moment

Do you have control over the build process on your side? I'm hoping it would be straightforward for you to sanitize the branch name when generating a tag.

_From @edkellena on January 9, 2018 22:12_

Fair enough 馃憤 I did wonder whether it would be a fruitless ask! Would be happy to attempt a PR for the generation, but without the UI setting available, that would be a bit pointless.

I do have some very hacky workaround at the moment, which I'll try to unhack soon. Cheers though!

Always worth asking! Thanks for understanding 馃檪 .

Is it still a problem to implement? We have exactly the same issue

You could always monkey-patch it, now whether or not you _should_...

module Dependabot
  class PullRequestCreator
    class BranchNamer
      def new_branch_name
        super.gsub(TO_REMOVE, TO_REPLACE)
      end
    end
  end
end

if you use dependabot v2 just add to your dependabot.yml

pull-request-branch-name:
      separator: "-"

https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#pull-request-branch-nameseparator

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Spomky picture Spomky  路  4Comments

cscherrer picture cscherrer  路  4Comments

christoferolaison picture christoferolaison  路  3Comments

exequiel09 picture exequiel09  路  4Comments

tjwallace picture tjwallace  路  3Comments