This repository has been archived by the owner on Jul 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagent.yml
75 lines (62 loc) · 2.55 KB
/
agent.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Agent
on:
pull_request:
jobs:
restyled:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
steps:
- run: set-pr-status pending "Restyling" ${{ env.JOB_URL }}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: restyled-io/actions/setup@v1
- id: restyler
uses: restyled-io/actions/run@v1
with:
committer-email: "commits@restyled.io"
committer-name: "Restyled.io"
job-url: ${{ env.JOB_URL }}
log-format: ${{ env.LOG_FORMAT }}
log-level: ${{ env.LOG_LEVEL }}
- if: ${{ steps.restyler.outputs.differences == 'true' }}
run: |
# Store differences patch
log-info "context[patch]=true" <<'EOM'
${{ steps.restyler.outputs.git-patch }}
EOM
log-info <<'EOM'
NOTE: you can manually apply these fixes by running:
git checkout <your branch>
curl ${{ env.JOB_URL }}/patch | git am
git push
EOM
- id: create-pull-request
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
uses: peter-evans/create-pull-request@v6
with:
token: ${{ github.token }}
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
- if: |
steps.restyler.outputs.differences == 'false' &&
steps.restyler.outputs.skipped == 'true'
run: set-pr-status success "Restyling skipped" ${{ env.JOB_URL }}
- if: |
steps.restyler.outputs.differences != 'true' &&
steps.restyler.outputs.skipped != 'true'
run: set-pr-status success "No differences" ${{ env.JOB_URL }}
- if: |
steps.restyler.outputs.differences == 'true' &&
steps.restyler.outputs.skipped != 'true'
run: set-pr-status failure "Restyled found differences" '${{ steps.create-pull-request.outputs.pull-request-url }}'
- if: ${{ failure() }}
run: set-pr-status error "Restyled errored" ${{ env.JOB_URL }}