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.
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.'
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: