⚡️ Recap

March 20, 2023 · View on GitHub

CI GitHub Marketplace

Tired of writing long pull request descriptions? or worse, not writing them at all?

This Github action will summarize the most significant changes in a pull request using GPT.

The objective of this action is to:

  • Reduce the time spent writing the pull request description.
  • Help developers understand the changes before reviewing them.

Running this action will add a comment to the pull request summarizing the changes. For example:

Privacy

  • No repository data is collected, stored, or distributed by this GitHub action. This action is state-less.
  • Minimal data is sent to Mixpanel to improve this action. However, you can opt out using the telemetry option.

Usage

Just add this action to one of your workflow files:

      - name: Recap changes
        uses: flowwer-dev/recap@main

Action inputs

The possible inputs for this action are:

ParameterDescriptionDefault
openai-apikeyAn API Key for your OpenAI account. This parameter is required. Check how to get an API here.null
publish-asWhere to publish the results. Possible values: as a COMMENT, on the pull request DESCRIPTION.COMMENT
telemetryIndicates if the action is allowed to send monitoring data to the developer. This data is minimal and helps me improve this action. This option is a premium feature reserved for sponsors.true

Examples

Minimal config

Add this to the file .github/workflows/recap.yml in your repo:

name: Pull Request Recap

on:
  pull_request:
    types: [opened]

jobs:
  recap:
    runs-on: ubuntu-latest
    steps:
      - name: Recap changes
        uses: flowwer-dev/recap@main
        with:
          openai-apikey: ${{ secrets.ADD_YOUR_OPENAI_APIKEY }}

This config will:

  • Recap the most significant changes included in the Pull Request.
  • Post them as a comment.

How the get an OpenAI API Key?

  1. Create an account on OpenAI's developers site.
  2. Go to Config > View API Keys.
  3. Press the Create new secret key button and copy the value.
  4. Voilà!

Troubleshooting

I get the error "Error commenting on the pull request...".

This error happens when the organization configures the action's permissions as read. To fix it, overwrite them by adding a permissions configuration in the workflow file. The minimum required permissions are contents: read and pull-requests: write:

jobs:
  recap:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - name: Run pull request recap
        uses: flowwer-dev/recap@main
I'm a sponsor but still getting the error "...is a premium feature, available to sponsors".
  1. Check the sponsorship comes from the account that owns the configured repository (usually an organization).
  2. Ensure the sponsorship is configured as public; otherwise, the action cannot access the sponsorship information. If you prefer to keep it private, please reach out to make it work for you that way 😉.

Premium features ✨

This action offers some premium features only for sponsors:

  • Disabling telemetry.
  • More coming soon.

The suggested sponsorship is $20 USD / month. However, if it's not possible for you or your organization, please consider supporting it with any amount you can. Even a one-time sponsorship will enable the Premium features and encourage the progress of this project.

Being a sponsor will also give you access to the premium features in all my other projects.

Thanks for your support! 💙

Author

@manuelmhtr
🇲🇽 Guadalajara, MX

Help

This project is maintained by a single person, considering supporting the project by:

  • ⭐ Star this repo.
  • Becoming a sponsor.

License

MIT