backstage

How do I validate a GitHub repository name?


I would like to enforce a naming convention when a component is created by a software template. In my template.yaml, the pattern regex works as expected on the input string for component name, but the same regex doesn't work on the input string of the repoURL. How do you validate and enforce a naming convention on a new repository created by the scaffolder?

https://backstage.io/docs/features/software-templates/input-examples#simple-input-with-basic-validations


Solution

  • I solved the problem by removing the input fields for the repository name and setting the repoUrl: to the component name that gets validated correctly with the pattern feature.

    repoUrl: github.com?owner=owner&repo=${{ parameters.name }}