Introduction:
Before you can use dynamic config in CircleCI, you need to toggle on the "Enable dynamic config using setup workflows" setting, in your Advanced project settings, in the CircleCI UI.
However, it is also possible to perform this operation via the CircleCI API v1.
Prerequisites (If Applicable):
If you don't already have one that you can use, you'll need to generate a personal API token for a user who has, at least, write access on the related project..
Instructions:
Retrieve the personal API token (see prerequisites)
Programmatically enable the setting
The following example uses cURL+shell but you can wrap the API call and use it with your favourite language.
curl --location --request PUT 'https://circleci.com/api/v1.1/project/<VCS>/<ORG_NAME>/<NEW_REPO_NAME>/settings' \ --header 'Content-Type: application/json' \ --header 'Circle-Token: <API_TOKEN>' \ --data-raw '{ "feature_flags":{"setup-workflows": true} }'
Outcome:
If the operation is successful, you'll receive a 200 response.
Additional Notes:
You can programmatically disable the setting by replacing true with false in the above sample request.