Uses an LLM to assign labels to a issue.
Note
This action uses GitHub Models for LLM inference.
This action analyzes a GitHub issue and tags it with relevant labels using a large language model (LLM) from GitHub Models. The algorithm works as follows:
- Fetch Issue and Labels: Retrieves the issue content and the list of available labels from the repository.
- Prepare Prompt: Constructs a prompt for the LLM, including:
- The issue title and body
- The list of available labels with descriptions
- Any existing labels on the issue
- Optional additional instructions
- A required output format (INI-style:
<label> = <reasoning>
, ranked by relevance)
- Run LLM Inference: Sends the prompt to the LLM to generate label suggestions and reasoning.
- Parse and Filter: Parses the LLM output, filters for valid and relevant labels, and limits the number of labels based on configuration.
- Update Issue: Updates the GitHub issue with the new set of labels, combining existing and newly suggested ones.
Tip
Improve the description of your labels to increase the accuracy of the LLM's suggestions.
github_token
: required GitHub token withmodels: read
permission at least. (required)github_issue
: GitHub issue number to use when generating comments. This value is typically inferred from the event context.instructions
: Additional instructions to the LLM on how to label the issue.labels
: Comma-separated list of labels to use.max_labels
: Maximum number of labels to assign to the issue.debug
: Enable debug logging.
Note that duplicate
and wontfix
labels are always excluded from the suggestions, as they are not useful for categorization.
Add the following to your step in your workflow file:
on:
issues:
types: [opened, reopened, edited]
...
permissions:
contents: read
issues: write
models: read
...
jobs:
issue-labeller:
...
steps:
- uses: pelikhan/action-genai-issue-labeller@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
This workflow will label issues using GitHub Models. It also supports manual triggering with an input for the issue number.
name: GenAI Issue Labeller
on:
issues:
types: [opened, reopened, edited]
permissions:
contents: read
issues: write
models: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number }}
cancel-in-progress: true
jobs:
genai-issue-labeller:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pelikhan/action-genai-issue-labeller@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
See CONTRIBUTING.md for details on how to contribute to this action.