Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add auto-PR description action #20

Merged
merged 1 commit into from
May 20, 2024
Merged

feat: Add auto-PR description action #20

merged 1 commit into from
May 20, 2024

Conversation

nwthomas
Copy link
Owner

@nwthomas nwthomas commented May 20, 2024

Problem

There was no automated mechanism to generate pull request descriptions based on the code changes, commit messages, and context from the existing files in the repository.

Solution

This pull request introduces an automation workflow that automatically generates detailed pull request descriptions using GitHub Actions and OpenAI's language model capabilities.

The key changes include:

  1. Pull Request Template: Added a markdown template for pull request descriptions.
  2. GitHub Workflow: Created a GitHub Actions workflow that triggers on pull request events (opened and synchronize). This workflow:
    • Checks out the repository.
    • Sets up a Python environment.
    • Installs necessary dependencies.
    • Fetches pull request information.
    • Generates a detailed pull request description using the OpenAI model.
    • Updates the pull request description.
  3. Python Script: Added a Python script (main.py) to handle the logic for generating the pull request description. This script:
    • Fetches the pull request data and diffs.
    • Embeds the repository documents using Pinecone.
    • Searches embeddings to retrieve context.
    • Formats the data into a prompt.
    • Calls the OpenAI model to generate the description.
    • Updates the pull request with the new description.
  4. Dependencies and Setup: Added necessary dependencies in requirements.txt and a setup configuration in setup.py.
  5. Git Ignore: Updated the .gitignore file to exclude unnecessary files and directories.
  6. License: Added the MIT License file.

Testing

  • The workflow was tested to ensure that it correctly triggers on pull request events and generates the appropriate descriptions.
  • The Python script was tested to ensure it properly interacts with the GitHub API, embeds documents, formats the prompt, and integrates with the OpenAI model.
  • Verified that the generated pull request descriptions follow the template format and include relevant context.

Reverting

  • To revert, the workflow can be disabled or deleted from the repository.
  • Any additional artifacts or configurations added can be removed to restore the repository to its previous state.

Copy link

vercel bot commented May 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
personal-portfolio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2024 5:53am

@nwthomas nwthomas merged commit 49be903 into main May 20, 2024
3 checks passed
@nwthomas nwthomas deleted the ai-github-actions branch May 20, 2024 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant