Skip to content

nikpivkin/auto-label

Repository files navigation

ChatGPT Auto Labeler Action

The ChatGPT Auto Labeler Action is a GitHub Action that automatically assigns labels to issues, discussions, and pull requests based on responses generated by ChatGPT. This action utilizes the power of ChatGPT to analyze the content and title of these artifacts and suggests suitable labels from the available labels.

image

Usage

To use this action, you need to set up the necessary inputs and provide your ChatGPT API token.

Inputs

Name Description Default
openai-api-key API token for ChatGPT. Required
gpt-model The ChatGPT model used. See available models here. "gpt-3.5-turbo"
gh-token GitHub personal access token.
timeout Timeout in seconds. 60
details Additional details for label suggestions. For example: SBOM is not misconfig.
excluded-labels A comma-separated list of labels to exclude from automatic assignment.

Example Workflow

Create a workflow file (e.g., .github/workflows/auto-labeling.yaml) with the following content:

name: Auto Labeling

on:
  issues:
    types:
      - opened
  pull_request:
    types:
      - opened

jobs:
  auto-label:
    runs-on: ubuntu-latest

    steps:
      - name: Auto Labeling with ChatGPT
        uses: nikpivkin/auto-label@v0
        with:
          openai-api-key: ${{ secrets.OPENAI_API_KEY }}
          gh-token: ${{ secrets.MY_PERSONAL_GH_TOKEN }}
          excluded-labels: "duplicate"

    # Add additional steps as needed

Configuration

ChatGPT API Token: Obtain a ChatGPT API token from the ChatGPT OpenAI API.

Workflow Trigger: Configure the workflow trigger as needed. The example above triggers the workflow when a new issue or pull request is opened.

License

This project is licensed under the MIT License.