Skip to main content
Auto-flagging is available to customers on select plansAuto-flagging is only available to customers on certain plans. To learn more, read about our pricing or contact Sales.
Agent skill availableIf you use an AI coding agent, you can use the LaunchDarkly launchdarkly-flag-create agent skill to create a flag and wrap your code behind it from your local repository. It explores how your codebase already uses flags, creates the flag in LaunchDarkly, and adds evaluation code that matches existing patterns. It requires the LaunchDarkly hosted Model Context Protocol (MCP) server.To flag and release a pull request’s change end to end, use the flag-and-release-change agent skill instead.To install the skill, run npx skills add https://github.com/launchdarkly/ai-tooling --skill launchdarkly-flag-create.To learn more, read LaunchDarkly agent skills.
This topic explains how auto-flagging in Release Autopilot creates feature flags for your pull requests, how it assigns a maintainer to each flag, and how it handles projects that require a team maintainer. Auto-flagging creates feature flags for the changes in your pull requests. When you open a pull request, auto-flagging analyzes the change. When the change needs a flag, auto-flagging proposes one, creates it in LaunchDarkly, and wraps the code behind it. If you agree with the proposed change, you can approve it either in the LaunchDarkly UI or by responding @launchdarkly approve in the pull request comments. Use auto-flagging when you want flags created for your changes without creating each one by hand. Auto-flagging provides the following benefits:
  • Changes that need a flag get one, which means you can control how those changes release.
  • Auto-flagging assigns a maintainer to each flag when it creates the flag, so every flag has an owner from the start.
Developers do not need to create flags or assign maintainers for these changes. Auto-flagging runs on the repositories you connect to LaunchDarkly. To learn how to connect a repository, read Set up auto-flagging.

How auto-flagging assigns flag maintainers

The maintainer of a flag is the LaunchDarkly member or team responsible for it. Auto-flagging attributes each pull request to a LaunchDarkly member and sets that member as the maintainer of the flags it creates. You do not need to specify a maintainer when auto-flagging creates the flag. Auto-flagging checks these GitHub accounts in order and attributes the pull request to the first one that belongs to a person, not a bot:
  • The member who claimed the pull request with the @launchdarkly claim command.
  • The pull request author.
  • The first assignee of the pull request.
  • The author of a commit in the pull request.
  • A person named in a Co-Authored-By trailer in a commit.
  • A person named in a “Requested by” line in the pull request description.
When your project requires a team maintainer, auto-flagging uses a team instead of a member.

What happens when your project requires a team maintainer

You can configure a LaunchDarkly project to require a team as the maintainer of every new flag. Auto-flagging creates flags with a member as the maintainer. This means it needs a team before it can create a flag in one of these projects. When auto-flagging creates a flag in a project that requires a team maintainer, it finds the teams that the pull request owner belongs to:
  • If the owner belongs to one team, auto-flagging uses that team as the maintainer.
  • If the owner belongs to more than one team, auto-flagging asks you to choose one. Reply @launchdarkly refine maintainer <team-key> with the key of one of the owner’s teams, then reply @launchdarkly approve. The comment links to a page where the owner can find their teams.
  • If the owner does not belong to a team, auto-flagging cannot create the flag. Ask a LaunchDarkly admin to add the owner to a team, then reply @launchdarkly replan.

Set up auto-flagging

Auto-flagging requires the LaunchDarkly GitHub app. To learn how to install it, read Install the app. To set up auto-flagging:
  1. Navigate to the LaunchDarkly project where auto-flagging creates flags, click the project dropdown, and select Project settings.
  2. Select Automations. The “Automations” page appears.
  3. Turn on the switch in the “Auto-flagging” section.
  4. Turn on the switch for each repository where you want auto-flagging to run.
  5. Click Save in the section.
Auto-flagging runs on the repositories you turned on. A repository that you have not turned on does not run. To learn more, read Turn on capabilities for a project.

Examples

These examples show how auto-flagging assigns a maintainer and how it handles a project that requires a team maintainer.

Create a flag with a member as the maintainer

A developer opens a pull request that adds a new checkout option. Auto-flagging determines that the change needs a flag. The project does not require a team maintainer, which means auto-flagging creates the flag with the developer as the maintainer.

Attribute a bot-authored pull request

A bot opens a pull request that adds a new checkout option. The commit includes a Co-Authored-By trailer that names a developer. Auto-flagging attributes the pull request to the developer and sets the developer as the maintainer of the flag. A developer can also claim a bot-authored pull request by replying @launchdarkly claim. Auto-flagging then attributes the pull request to that developer.

Assign a team maintainer

A developer opens a pull request that adds a new checkout option. Auto-flagging determines that the change needs a flag and tries to create it with the developer as the maintainer. The project requires a team maintainer, and the developer belongs to more than one team. Auto-flagging asks which team should maintain the flag. The developer replies @launchdarkly refine maintainer <team-key> with the key of one of their teams, then replies @launchdarkly approve. Auto-flagging creates the flag with that team as the maintainer.