Coder Social home page Coder Social logo

platisd / openai-pr-description Goto Github PK

View Code? Open in Web Editor NEW
37.0 2.0 17.0 288 KB

Autofill your pull request descriptions with the power of OpenAI

License: MIT License

Dockerfile 3.21% Python 90.48% Shell 6.31%
chatgpt openai pull-request-descriptions pull-requests

openai-pr-description's Introduction

platisd/openai-pr-description GitHub Action

Autofill the description of your pull requests with the power of OpenAI!

openai-pr-description-screenshot

What does it do?

platisd/openai-pr-description is a GitHub Action that looks at the title as well as the contents of your pull request and uses the OpenAI API to automatically fill up the description of your pull request. Just like ChatGPT would! ๐ŸŽ‰
The Action tries to focus on why the changes are needed rather on what they are, like any proper pull request description should.

The GitHub Action will only run when a PR description is not already provided. In other words it will not accidentally overwrite your existing description. The idea is this Action will save you the time and trouble of writing meaningful pull request descriptions.
You can customize it in different ways. One of them allows the Action to only run on pull requests started by specific users, e.g. the main maintainers of the repository. Keep in mind the OpenAI API is not free to use. That being said, so far it's been rather cheap, i.e. around ~$0.10 for 15-20 pull requests so far.

How can you use it?

  1. Create an account on OpenAI, set up a payment method and get your OpenAI API key.
  2. Add the OpenAI API key as a secret in your repository's settings.
  3. Create a workflow YAML file, e.g. .github/workflows/openai-pr-description.yml with the following contents:
name: Autofill PR description

on: pull_request

jobs:
  openai-pr-description:
    runs-on: ubuntu-22.04

    steps:
      - uses: platisd/openai-pr-description@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          openai_api_key: ${{ secrets.OPENAI_API_KEY }}
Input Description Required Default
github_token The GitHub token to use for the Action Yes
openai_api_key The OpenAI API key to use, keep it hidden Yes
pull_request_id The ID of the pull request to use No Extracted from metadata
openai_model The OpenAI model to use No gpt-3.5-turbo
max_tokens The maximum number of prompt tokens to use No 1000
temperature Higher values will make the model more creative (0-2) No 0.6
sample_prompt The prompt to use for giving context to the model No See SAMPLE_PROMPT
sample_response A sample response for giving context to the model No See GOOD_SAMPLE_RESPONSE

Demo

openai-pr-description-screenshot

cpp-command-parser-screenshot

clang-tidy-pr-comments-screenshot

403 error when updating the PR description

If you get a 403 error when trying to update the PR description, it's most likely because the GitHub Action is not allowed to do so. The easiest way forward is to grant the necessary permissions to the GITHUB_TOKEN secret at <your_repo_url>/settings/actions under Workflow permissions.

openai-pr-description's People

Contributors

platisd 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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

openai-pr-description's Issues

Solution not working with Azure OpenAPI token

Hi
I was trying to use this action in my personal exploration project. I am interested to know whether this solution works only with OpenAI token keys or Azure openAi keys is acceptable. As per microsoft documentation there shouldn't be much difference in using any of the keys but your solution is giving me issue of "openai.error.AuthenticationError: Incorrect API key provided:"
Although the keys are correctly generated.
Any hint regarding this?

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.