Giter Site home page Giter Site logo

ant0wan / openai-pr Goto Github PK

View Code? Open in Web Editor NEW
34.0 2.0 1.0 270 KB

Pull request descriptions wrote by OpenAI.

Home Page: https://github.com/marketplace/actions/openai-pr-description-generator

License: GNU General Public License v3.0

Python 94.01% Shell 5.99%
actions ongoing openapi

openai-pr's Introduction


Logo

OpenAI PR

This GitHub Action generates a pull request description using OpenAI's GPT-3 API.


The OpenAI PR Description Generator is a GitHub Action that generates a pull request description using OpenAI. This action utilizes an OpenAI model to generate concise and context-aware pull request descriptions based on the provided information.

Pull request description

(An example of a pull request description generated by OpenAI PR)

Usage

To use the OpenAI PR Description Generator in your GitHub workflow, you can follow the example below:

name: OpenAI PR Description Generator

on:
  pull_request:
    types:
      - opened
      - synchronize

permissions:
  pull-requests: write
  contents: read

jobs:
  pull-request:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: Ant0wan/openai-pr@v1
        with:
          api-key: ${{ secrets.OPENAI_API_KEY }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Inputs

The OpenAI PR Description Generator action provides the following inputs:

  • api-key (required): Your OpenAI API key. You can get one from the OpenAI website.
  • model (optional): Specifies the OpenAI model to use. Default value is "text-davinci-003".
  • template (optional): PR content template for OpenAI to understand what should be included in the pull request description. Default value is an empty string.
  • template-filepath (optional): Path to the PULL_REQUEST_TEMPLATE.md file. Default value is .github/PULL_REQUEST_TEMPLATE.md.
  • header (optional): Intro phrase that provides context to the model. Default value is "Based on the output of the command 'git diff', could you please generate a pull request description using the provided information? Be concise. Description must follow this format:\n".
name: OpenAI PR Description Generator

on:
  pull_request:
    types:
      - opened
      - synchronize

permissions:
  pull-requests: write
  contents: read

jobs:
  pull-request:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Generate PR Description
        uses: Ant0wan/openai-pr@v1
        with:
          api-key: ${{ secrets.OPENAI_API_KEY }}
          model: "text-davinci-002"
          template: |
            ## Description

            This pull request addresses the following issues:

            - Issue 1
            - Issue 2

            ## Changes

            - Change 1
            - Change 2
          header: "Hello, I need your help in generating a pull request description. Please analyze the changes and provide a concise description."
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Another way of using it specifying only template-filepath:

name: OpenAI PR Description Generator

on:
  pull_request:
    types:
      - opened
      - synchronize

permissions:
  pull-requests: write
  contents: read

jobs:
  pull-request:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Generate PR Description
        uses: Ant0wan/openai-pr@v1
        with:
          api-key: ${{ secrets.OPENAI_API_KEY }}
          template-filepath: ".github/PR_TEMPLATE.md"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

How It Works

This action runs as a composite action with three steps:

  1. Install Python: Installs Python version 3.11.
  2. Install Dependencies: Installs the required dependencies listed in requirements.txt.
  3. Generate Description: Runs python main.py to generate the pull request description using OpenAI's GPT-3 API and leveraging GitHub Api.

Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please create an issue in the repository associated with this README.

License

This project is licensed under the GNU General Public License v3.0. You are free to modify and distribute the code as per the terms of the license. See the LICENSE file for more details.

openai-pr's People

Contributors

ant0wan avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.