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.
@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.
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 claimcommand. - 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-Bytrailer in a commit. - A person named in a “Requested by” line in the pull request description.
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:- Navigate to the LaunchDarkly project where auto-flagging creates flags, click the project dropdown, and select Project settings.
- Select Automations. The “Automations” page appears.
- Turn on the switch in the “Auto-flagging” section.
- Turn on the switch for each repository where you want auto-flagging to run.
- Click Save in the section.
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 aCo-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.