Skip to content

This GitHub Action will take the changes from the Git working directory and apply them as GitHub code review suggestions.

License

Notifications You must be signed in to change notification settings

parkerbxyz/suggest-changes

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Suggest changes

This GitHub Action takes changes from the working directory (using git diff) and applies them as suggested changes in a pull request review. This can be useful after running a linter or formatter that automatically makes fixes for you.

  • Gives contributors an opportunity to review and accept automated changes
  • Enables semi-automated changes to pull requests without the needing to use a personal access token (PAT) or GitHub App installation token to trigger workflow runs

Note

This GitHub Action only works on pull_request workflow events.

Usage

You can use this action in an existing workflow and have it run after a linter or formatter step. For example, if you have a workflow that runs markdownlint on all Markdown files in a pull request, you can use this action to suggest changes to the pull request after markdownlint has run.

name: 'markdownlint'

on:
  pull_request:
    paths: ['**/*.md']

permissions:
  contents: read
  pull-requests: write

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: DavidAnson/markdownlint-cli2-action@v15
        with:
          fix: true
          globs: '**/*.md'
      - uses: parkerbxyz/suggest-changes@v1
        with:
          comment: 'Please commit the suggested changes from markdownlint.'
          event: 'REQUEST_CHANGES'

Note

Suggested changes are limited to 3000 files per pull request

Here is what an automated pull request review with suggested changes would look like using the workflow configuration above:

A screenshot showing an automated pull request review with suggested changes

About

This GitHub Action will take the changes from the Git working directory and apply them as GitHub code review suggestions.

Topics

Resources

License

Stars

Watchers

Forks