-
Notifications
You must be signed in to change notification settings - Fork 20
GitHub Actions
Pat Brisbin edited this page Jul 23, 2024
·
5 revisions
Before using Restyled as a GitHub Action, make sure you prevent the hosted version from running. 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.
Then, create the file .github/workflows/restyled.yml
:
on:
pull_request:
jobs:
restyled:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: restyled-io/restyler/actions/setup@main
- id: restyler
uses: restyled-io/restyler/actions/run@main
# See below
After the above steps have run, if there were style differences, they were corrected and committed. You can then do some or all of the things described below by adding more steps to the jobs. Note that some of these steps may require adjusting Job permissions or using a Personal Access Token.
- 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: ${{ steps.restyler.outputs.restyled-labels }}
reviewers: ${{ steps.restyler.outputs.restyled-reviewers }}
team-reviewers: ${{ steps.restyler.outputs.restyled-team-reviewers }}
delete-branch: true
Works for forks? No
- run: git push
Works for forks? Untested
# TODO
Works for forks? Yes
- if: ${{ steps.restyler.outputs.differences == 'true' }}
run: |
echo "Restyled found differences" >&2
exit 1
Works for forks? Yes
📣 Please read: GitHub Actions Pivot
- Getting Started
- What to Expect
- Supported Languages
- Configuring
- Excluding Files
- Disabling
- Common Errors
- Missing GitHub Student Developer Pack Plan
- Plan Upgrade Required
- Configuration Errors
- Restyle Errors
- Restyle Error 127
- Restyle Error 137
- Push Rejected
- Git Error: bad object
- Git Error: Couldn't find remote ref
- Labels or Ignore Labels not working
- Restyle PR not created
- Restyle PR not closed
- Specific Restylers
- Reference
- Development
- Policies