Files
pr-agent/docs/GENERATE_CUSTOM_LABELS.md
2023-10-29 08:58:12 +02:00

1.7 KiB

Generate Custom Labels

The generte_labels tool scans the PR code changes, and given a list of labels and their descriptions, it automatically suggests labels that match the PR code changes.

It can be invoked manually by commenting on any PR:

/generate_labels

For example:

If we wish to add detect changes to SQL queries in a given PR, we can add the following custom label along with its description:

When running the generte_labels tool on a PR that includes changes in SQL queries, it will automatically suggest the custom label:

Configuration options

To enable custom labels, you need to add the following configuration to the custom_labels file:

  • Change enable_custom_labels to True: This will turn off the default labels and enable the custom labels provided in the custom_labels.toml file.
  • Add the custom labels to the custom_labels.toml file. It should be formatted as follows:
[custom_labels."Custom Label Name"]
description = "Description of when AI should suggest this label"
  • You can add modify the list to include all the custom labels you wish to use in your repository.

Github Action

To use the generte_labels tool with Github Action:

  • Add the following file to your repository under env section in .github/workflows/pr_agent.yml
  • Comma separated list of custom labels and their descriptions
  • The number of labels and descriptions should be the same and in the same order (empty descriptions are allowed):
CUSTOM_LABELS: "label1, label2, ..."
CUSTOM_LABELS_DESCRIPTION: "label1 description, label2 description, ..."