

AutoPR
1.2k 79What is AutoPR ?
AutoPR automates various tasks in the pull request workflow. It features automated generation of living summaries of code in READMEs, keeps track of TODOs in GitHub issues, and maintains a history of API call results in git. Additionally, it can automatically summarize changes in pull requests when a βsummarizeβ label is added. Users can configure AutoPR through YAML files to tailor its functionality to their specific needs.
π AutoPR Features
-
π³ Living summaries of your code in nested READMEs
-
π TODOs kept track of in issues
-
β³ Keep history of an API callβs result in git
-
π Summarize changes by adding a βsummarizeβ label to a PR
-
π«΅ Custom actions configured in YAML
Install AutoPR
Prerequisites
You need your own OpenAI API key.
Setup
Follow these steps to set up AutoPR in your GitHub repository:
-
Create a new file in your repository named .github/workflows/autopr.yaml and copy the contents from the GitHub workflow template.
-
Create a new file in your repository named .autopr/triggers.yaml and copy the contents from the triggers template.
-
In your GitHub repository settings, navigate to Secrets and variables -> Actions and add your OpenAI API key as OPENAI_API_KEY.
-
In your GitHub repository settings, go to Actions -> General and scroll down to Workflow permissions. Enable Allow GitHub Actions to create and approve pull requests.
Thatβs it! Check out the Configuring guide to see how to customize AutoPR for your repository.
π³ Living Summary
-
This folder contains various files and directories related to automating tasks in a pull request workflow.
-
The Dockerfile sets up a Docker image and installs dependencies using Poetry.
-
The LICENSE.md file contains the MIT License for the software.
-
The Makefile defines targets for formatting, type checking, testing, and more.
-
The action.yml file configures an automatic pull request workflow.
-
The autopr directory contains Python files and directories for actions, services, workflows, and configurations.
-
The entrypoint.sh file is a shell script that sets up Git configuration.
-
The poetry.lock file provides an overview of the projectβs dependencies.
-
The pyproject.toml file is a configuration file for the Python project.
-
The strict_workflow_schema.json and trigger_schema.json files define schemas for strict workflows and triggers.
-
The workflow_schema.json file defines a schema for workflow definitions.
Dockerfile
ποΈ Sets up a Docker image based on the duffn/python-poetry:3.9-bullseye
image
π§ Installs git from the bullseye-backports repository
π₯ Copies an entrypoint script and makes it executable
π₯ Copies the pyproject.toml
and poetry.lock
files
π§ Activates the virtual environment and installs the project dependencies using Poetry
π₯ Copies the rest of the files to the /app
directory
π§ Installs the application using Poetry
π Sets the entrypoint to /entrypoint.sh
for running the app
LICENSE.md
π This file contains the MIT License.
π The license grants permission to use, modify, and distribute the software.
π The license requires the copyright notice and permission notice to be included in all copies.
π« The software is provided βas isβ without warranty.
π The license is valid until 2023.
πΌ The license is owned by Raphael Francis Ltd.
Makefile
π This file is a makefile-like configuration file.
π§ It defines various targets and their associated commands.
π» The targets are: format
, type
, test
, schema
, and all
.
π§ The format
target runs a command to format code using the black
tool.
π§ The type
target runs a command to perform type checking using pyright
.
π§ The test
target runs pytest on the autopr/tests
directory.
π§ The schema
target runs a command to generate configuration entrypoints using autopr.models.config
.
π§ The all
target runs all the targets in sequence: format
, type
, test
, and schema
.
π§ This file is meant to automate common development tasks and ensure code quality.
action.yml
π This file is a configuration file for an automatic pull request workflow.
π§ It specifies the details for running the workflow, such as the Docker image to use.
π¨ It also includes branding information, such as the icon and color to use.
π The file defines inputs required for the workflow, such as the GitHub token and base branch.
π₯ It includes a default loading GIF URL to display while the pull request is being generated.
πΏ The file defines a template for the name of the target branch.
π It specifies whether to overwrite existing branches and pull requests when creating from issues.
autopr/
This folder contains a collection of Python files and directories that provide various actions, services, workflows, and configurations for automating tasks in a pull request workflow. The files include actions for running commands, generating choices, publishing comments on GitHub issues, committing changes, searching for keywords, making API calls, and more. There are also files for managing logging, defining triggers and workflows, configuring services, and defining data models. The directories contain additional files for managing and running actions, defining workflows, and handling events. Overall, this folder provides a comprehensive set of tools and functionalities for automating tasks in a pull request workflow.
entrypoint.sh
π The file is a shell script
π§ It sets the Git configuration for a specific directory
βοΈ It sets the user email and name for Git commits
π¦ It activates a virtual environment
π It runs a Python module called autopr.gh_actions_entrypoint
poetry.lock
π This file is an executive summary of a project or report
π It provides a high-level overview of the main points
π It highlights key findings, conclusions, and recommendations
π It may include a summary of data or analysis
π₯ It is intended for someone who is new to the project or report
π« It does not include trivial details or technical explanations
π‘ It gives a clear understanding of the purpose and scope of the project
π It provides a quick glance at the content without going into depth
πΌ It serves as a starting point for further exploration or discussion
π It is concise and easy to read, even if the file is empty
pyproject.toml
π This file is a configuration file for a Python project using Poetry.
π It contains information about the projectβs name, version, and authors.
π The license of the project is specified as MIT.
π¦ It lists the packages and their dependencies required for the project.
π§ͺ There are separate dependencies for testing and development.
π§ The build system used is Poetry.
π The file also includes configuration for the Pyright static type checker.
π It specifies the line length and target version for the Black code formatter.
strict_workflow_schema.json
π The file is a JSON schema describing a strict workflow definition.
π It defines various actions that can be performed within the workflow.
π Actions include commenting, setting issue titles, walking files, making API calls, running bash commands, and more.
π Each action has its own set of inputs and outputs.
π The workflow steps are defined as an array of actions.
π The schema also includes definitions for various data types and declarations used within the actions.
π The purpose of the file is to provide a standardized structure for defining and executing strict workflows.
ποΈ The schema can be used to validate and ensure the correctness of workflow definitions.
𧩠It allows for easy integration with other tools and systems that support the schema.
π The file can serve as a reference for understanding the structure and capabilities of strict workflows.
trigger_schema.json
π This file is a JSON schema definition for a configuration file.
π·οΈ It defines various action models and trigger models.
π The action models represent different actions that can be performed in a workflow.
π The trigger models represent different triggers that can initiate a workflow.
π The schema provides a structure for defining inputs, outputs, and other properties for each action and trigger.
π It also defines different types of declarations and templates that can be used within the actions and triggers.
π The βTopLevelTriggerConfigβ object is the main configuration object that contains an array of triggers.
π Each trigger can be of type βlabelβ, βcommentβ, βpushβ, or βcronβ.
π Overall, this file provides a standardized structure for defining workflows and their triggers and actions.
workflow_schema.json
π This file is a JSON schema definition for a workflow definition.
π§ It defines various types and properties for different actions and declarations used in the workflow.
π The schema includes definitions for actions like commenting, setting issue title, walking files, making API calls, running bash commands, etc.
π It also defines different types of declarations like template, variable, constant, and lambda declarations.
π The workflow definition includes a name, description, inputs, and outputs.
π’ It consists of a list of steps which can be actions, workflow invocations, or conditional statements.
π Conditional statements can have if-else branches and support different conditions like lambda expressions and context checks.
π Workflow invocations can be either regular or iterable.
π Overall, this file provides a structured definition for creating and executing workflows with various actions and conditions.