| name: Restyled |
| |
| on: |
| pull_request: |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref }} |
| cancel-in-progress: true |
| |
| jobs: |
| restyled: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| |
| - uses: restyled-io/actions/setup@bce8886781a3a4e9510a248d37a87e64ba143465 # v4 |
| |
| - id: restyler |
| uses: restyled-io/actions/run@bce8886781a3a4e9510a248d37a87e64ba143465 # v4 |
| |
| - name: Save restyle patch |
| if: ${{ steps.restyler.outputs.git-patch }} |
| env: |
| PATCH_CONTENT: ${{ steps.restyler.outputs.git-patch }} |
| run: | |
| printf '%s\n' "$PATCH_CONTENT" > /tmp/pr-${{ github.event.pull_request.number }}-restyled.patch |
| echo "Patch saved ($(wc -l < /tmp/pr-${{ github.event.pull_request.number }}-restyled.patch) lines)" |
| |
| - id: upload |
| if: ${{ steps.restyler.outputs.git-patch }} |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
| with: |
| name: pr-${{ github.event.pull_request.number }}-restyled |
| path: /tmp/pr-${{ github.event.pull_request.number }}-restyled.patch |
| if-no-files-found: ignore |
| overwrite: true |
| retention-days: 1 |
| |
| - name: Fail if restyle differences found |
| if: ${{ steps.restyler.outputs.differences == 'true' }} |
| run: | |
| echo "::error::Restyle differences found. Download patch: ${{ steps.upload.outputs.artifact-url }}" |
| echo "" |
| echo "To apply: unzip pr-${{ github.event.pull_request.number }}-restyled.zip && git am < pr-${{ github.event.pull_request.number }}-restyled.patch" |
| exit 1 |