GithubHelp home page GithubHelp logo

hzmslx / autopr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from irgolic/autopr

0.0 0.0 0.0 123 KB

Fix issues with AI-generated pull requests, powered by GPT-4

License: MIT License

Shell 0.59% Python 98.83% Dockerfile 0.58%

autopr's Introduction

๐Ÿš€ Automatic Pull Request Github Action ๐Ÿค–

This Github Action automatically writes code in pull requests using GPT-4. Built with Guardrails.

Roadmap

  • On new issue, generate code, push a branch, and open a pull request
  • Generate multiple commits
  • Update pull request on new issue/pull request comment
  • Update pull request based on code review comments
  • Alternative code generation models

Usage

Warning: This Github Action is currently in development, and in alpha release. If you're interested in using this action, please reach out on Discord.

The following input variables are used by the action:

  • github_token: The GitHub token to use for the action. This is automatically provided by GitHub, you do not need to create your own token.
  • openai_api_key: The OpenAI API key to use for generating the pull request.
  • issue_number: The issue number associated with the pull request.
  • issue_title: The title of the issue.
  • issue_body: The body of the issue.
  • base_branch: The base branch for the pull request. The default value is 'main'.

To include this Github action in your own repository, you can use the following example in your workflow file:

on:
  issues:
    types: [opened, edited]

permissions:
  contents: write
  issues: read
  pull-requests: write

jobs:
  autopr:
    runs-on: ubuntu-latest
    steps:
    - name: Install jq
      run: sudo apt-get install jq
    - name: Check if issue is created by collaborator
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        is_collaborator=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" \
          "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.event.issue.user.login }}" | jq -r '.message')

        if [ "$is_collaborator" == "Not Found" ]; then
          echo "Issue not created by a collaborator. Skipping action."
          exit 78
        fi
    - name: Checkout
      uses: actions/checkout@v2
      with:
        ref: main
        fetch-depth: 1
    - name: AutoPR
      uses: irgolic/AutoPR@main
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        openai_api_key: ${{ secrets.OPENAI_API_KEY }}
        issue_number: ${{ github.event.issue.number }}
        issue_title: ${{ github.event.issue.title }}
        issue_body: ${{ github.event.issue.body }}
        base_branch: main

Whenever a new issue is opened or edited, the action will push a branch named autopr/issue-# and open a pull request to the base branch. Please note that if the branch already exists (on issue edit), it will be overwritten.

autopr's People

Contributors

irgolic 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.