Configuring organization properties as code in SourceCraft

You can use the dedicated .sourcecraft repository to manage the general approval rules, branch policies, and custom fields in issues for all repositories in an organization, as well as its access policies. This ensures uniform development standards and simplifies administration.

When you create the .sourcecraft repository, all its configuration files automatically apply to all repositories in the organization. You can make this repository private; the configurations will persist across all the organization’s repositories.

Note

In the organization, the following restrictions apply to the special .sourcecraft repository:

  • Only an organization administrator can create the repository.
  • You cannot create the repository in, or migrate to, a project.
  • You cannot rename the repository. You also cannot rename any other repository to .sourcecraft.
  • You cannot change the default branch in the repository.

Configuration files

The .sourcecraft repository supports the following configuration files:

For approval rules, branch policies, and custom fields in issues, the syntax of organization-level settings is identical to that of repository-level settings.

How configurations are applied

Configuration changes are applied immediately after they are committed to either main or master branch of the .sourcecraft repository. Changes in other branches are not applied, allowing you to work on configuration changes in separate branches.

If there are configuration errors, the merge of branches is rejected with a detailed description of problems.

Approval rules and branch policies

Individual repositories can override approval rules and branch policies, but only to enforce stricter requirements. For example, if the organization level settings require two approvals for a pull request, a specific repository may increase this number to three approvals, but not reduce it to one.

Custom issue settings

The repository configuration takes precedence over the organization configuration. If an object with an identical slug exists in both configurations, the repository settings apply. The enum value lists from the repository configuration completely replace the organization lists.

On the issue page, organization fields are displayed first, followed by repository fields. The order within each group matches the order defined in the relevant .sourcecraft/issues.yaml file.

Useful links