Create, rename and delete repositories

Learn how to create, rename, and delete repositories using CBG

This public content is an excerpt from Flutter staff GitHub docs. It is published as a reference to show how GitHub is used for inner source at Flutter.

This guide provides instructions on how to create, rename, and delete repositories using the Codebase Governor (CBG). Follow these steps to efficiently manage your repositories within a capability.

Repository Creation

To create a new repository, add a repository configuration file within the appropriate capability folder. If the repository does not already exist in Flutter-Global, the Codebase Governor will automatically create it and apply all necessary configurations.

To create a new repository, follow these steps:

  1. Navigate to the org-config repository main page.
  2. Open the codebases folder.
  3. Open your capability folder or create a new one.
  4. Click the Add file > Create new file button.
  5. Enter your repository name in the Name your file... field. The file name must follow the <NAME_OF_REPOSITORY>.yml pattern. For example, for a repository named video-broadcast, the filename would be video-broadcast.yml.
  6. Add the repository configuration properties in the file contents textarea.
  7. Click on the Commit changes... button.
  8. Add a Commit message.
  9. Click on Propose changes to open a Pull Request.

After your pull request is open, CBG will run and display a comment similar to the image.

Once the pull request is approved and merged, CBG will create the repository and apply any changes defined in the configuration.

Repository Renaming

To rename a repository, you can use git mv:

  1. Clone the org-config repository:

       git clone git@github.com:Flutter-Global/org-config.git
    
  2. Create a new branch for the change. Replace <name-of-branch with your branch name.

       git checkout -b <name-of-branch>
    
  3. Navigate to the capability folder inside the codebases folder. Replace <your-capability-name> with the capability your name.

     cd org-config/capability/<your-capability-name>`
    
  4. Rename the repository configuration file, replacing <old-repository-config-file> and <new-repository-config-file> with the repository filenames, using the following command:

     git mv <old-repository-config-file> <new-repository-config-file>
    
  5. Add and commit the changes:

     git add .
     git commit -m "renaming a repository"
    
  6. Push the changes:

     git push
    
  7. Navigate to the org-config repository
  8. Open a PR based on the branch created

After your pull request is open, CBG will run and display a comment similar to the image below.

Once the pull request is approved and merged, CBG will rename the repository and apply any changes defined in the configuration.

Further reading

Repository Deletion

To delete a repository, remove the repository configuration file from the capability folder. The Codebase Governor will then remove the repository from the capability and archive it.

To delete a repository using the GitHub UI, follow these steps:

  1. Navigate to the org-config repository main page.
  2. Open the codebases folder.
  3. Open your capability folder.
  4. Open the repository configuration file by clicking on it.
  5. Click on the ... > Delete file button.
  6. Click on the Commit changes... button.
  7. Add a Commit message.
  8. Click on Propose changes to open a Pull Request.

After your pull request is open, CBG will run and display a comment similar to the image below.

Once the pull request is approved and merged, CBG will archive the repository for deletion.