Important
Before using Restyled as a GitHub Action, make sure you prevent any previous hosted installation from running. Otherwise, they may fight over the restyled branch. This can be done by uninstalling the GitHub App entirely, or configuring it for specific repositories and excluding the one where you plan to use GitHub Actions.
Features:
- Restyle a Pull Request
- Print instructions to apply locally with
git am
- Maintain a sibling PR, if the original was not a Fork
- Apply the
restyled
label and request review from the author - Fail the PR if differences were found
name: Restyled
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
restyled:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: restyled-io/actions/setup@v4
- id: restyler
uses: restyled-io/actions/run@v4
with:
fail-on-differences: true
- if: |
!cancelled() &&
steps.restyler.outputs.success == 'true' &&
github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-pull-request@v6
with:
base: ${{ steps.restyler.outputs.restyled-base }}
branch: ${{ steps.restyler.outputs.restyled-head }}
title: ${{ steps.restyler.outputs.restyled-title }}
body: ${{ steps.restyler.outputs.restyled-body }}
labels: "restyled"
reviewers: ${{ github.event.pull_request.user.login }}
delete-branch: true
The Restyled actions themselves require no permissions. However, contents:read
is required for actions/checkout
and pull-requests:write
is required for
peter-evans/create-pull-request
, which are both used in the example above.
Default permissions for workflows can be adjusted in your repository settings,
or a permissions
key can be used in the workflow itself. For more details, see
the documentation.
This software is licensed AGPLv3. See COPYING.