Configuration

A detailed explanation of configuration files and how they are combined.

Configuration files

The previous chapters describe the available configuration properties.
This chapter explains where And Action looks for configuration files and how multiple configurations are combined.

Configuration can be defined at two levels:

  • Organization level
  • Repository level

Organization-level configuration

To define configuration for an entire organization, create a repository named .github within that organization.

Inside that repository, create the file:

.github/andaction.yml

Example

If your organization is named my-org, the configuration file would be located at:

my-org/.github/.github/andaction.yml

This configuration applies to all repositories in the organization, unless overridden by repository-level configuration.


Repository-level configuration

You can also define configuration for a specific repository.

To do so, create the following file inside the repository:

.github/andaction.yml

This configuration only applies to that repository.


Configuration precedence

If both organization-level and repository-level configuration files exist, both configurations are combined.

The repository configuration takes precedence over the organization configuration.

The merge behavior works as follows:

  • Top-level properties are merged
  • Child properties are not merged
  • If a top-level property exists in both configurations, the repository configuration replaces the organization's property completely

Example

Organization configuration

actions:
  excluded-workflows:
    - Manually deploy app

deployment:
  environments:
    - name: dev
    - name: test
    - name: staging
      requires:
        - dev
        - test
    - name: production
      requires:
        - staging
  excluded-workflows:
    - Manually deploy app

Repository configuration

deployment:
  excluded-workflows:
    - Deploy
    - Test checks

Resulting configuration

actions:
  excluded-workflows:
    - Manually deploy app

deployment:
  environments:
    - name: dev
    - name: test
    - name: staging
      requires:
        - dev
        - test
    - name: production
      requires:
        - staging
  excluded-workflows:
    - Deploy
    - Test checks

In this example:

  • The actions configuration comes entirely from the organization configuration.
  • The deployment.environments configuration also comes from the organization configuration.
  • The deployment.excluded-workflows property from the repository configuration replaces the organization's value.