-
Notifications
You must be signed in to change notification settings - Fork 43
54 lines (48 loc) · 1.92 KB
/
reformat-code.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
name: Reformat code
on:
workflow_dispatch:
inputs:
file_mask:
description: 'File mask to reformat'
required: true
default: '*.java,*.kts,*.kt'
direct-commit:
type: boolean
default: false
description: Commit directly to source (instead of opening a PR)
jobs:
reformat:
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Do reformat
uses: leventeBajczi/[email protected]
with:
settings-file: "./doc/ThetaIntelliJCodeStyle.xml"
file-mask: ${{ inputs.file_mask }}
- name: Create Pull Request
if: ${{ !inputs.direct-commit }}
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
with:
commit-message: "Reformatted code"
branch: "code-reformat"
title: '[AutoPR] Reformatted code'
token: ${{ steps.generate-token.outputs.token }}
committer: ThetaBotMaintainer[bot] <139346997+ThetaBotMaintainer[bot]@users.noreply.github.com>
author: ThetaBotMaintainer[bot] <139346997+ThetaBotMaintainer[bot]@users.noreply.github.com>
- name: Commit changes
if: ${{ inputs.direct-commit }}
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a
with:
commit_message: "Reformatted code"
commit_user_name: ThetaBotMaintainer[bot]
commit_user_email: 139346997+ThetaBotMaintainer[bot]@users.noreply.github.com
commit_author: ThetaBotMaintainer[bot] <139346997+ThetaBotMaintainer[bot]@users.noreply.github.com>