File tree 3 files changed +88
-0
lines changed
3 files changed +88
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Format Files
2
+
3
+ # cpp
4
+ # csharp - https://github.com/dotnet/format ?
5
+ # java - prettier-plugin-java
6
+ # javascript - prettier
7
+ # python - black
8
+ # ruby - rufo
9
+ # swift - https://github.com/apple/swift-format ?
10
+ # typescript - prettier
11
+
12
+ on :
13
+ # pull_request_target:
14
+ # types: [opened, synchronize]
15
+ workflow_dispatch :
16
+
17
+ jobs :
18
+ Format :
19
+ runs-on : ubuntu-latest
20
+
21
+ strategy :
22
+ matrix :
23
+ node-version : [16.x]
24
+
25
+ steps :
26
+ - uses : actions/checkout@v3
27
+ with :
28
+ ref : ${{ github.head_ref }}
29
+ fetch-depth : 1
30
+
31
+ - name : Use Node.js (dependency)
32
+ uses : actions/setup-node@v1
33
+ with :
34
+ node-version : ${{ matrix.node-version }}
35
+
36
+ - name : Install Rufo (dependency)
37
+ run : |
38
+ sudo apt update
39
+ sudo gem install rufo
40
+
41
+ - name : Install Prettier
42
+ run : |
43
+ npm install -g prettier
44
+ npm install -g prettier-plugin-java
45
+
46
+ - name : Install Black
47
+ uses : BSFishy/pip-action@v1
48
+ with :
49
+ packages : black
50
+
51
+ - name : Format
52
+ run : |
53
+ prettier --config "$GITHUB_WORKSPACE/.prettierrc" --write "$GITHUB_WORKSPACE/javascript/*.js" 2>&1 || true
54
+ prettier --config "$GITHUB_WORKSPACE/.prettierrc" --write "$GITHUB_WORKSPACE/typescript/*.ts" 2>&1 || true
55
+ prettier --config "$GITHUB_WORKSPACE/.prettierrc" --write "$GITHUB_WORKSPACE/java/*.java" 2>&1 || true
56
+ rufo "$GITHUB_WORKSPACE/ruby" 2>&1 || true
57
+ python -m black "$GITHUB_WORKSPACE/python/" 2>&1 || true
58
+
59
+ - name : Push
60
+ run : |
61
+ git config --global user.email "[email protected] "
62
+ git config --global user.name "Bot-A0"
63
+ git add .
64
+ git commit -m "🎨 Format files (🛠️ from Github Actions)" || true
65
+ git push || true
Original file line number Diff line number Diff line change
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "endOfLine": "lf",
5
+ "overrides": [
6
+ {
7
+ "files": ["javascript/*.js"],
8
+ "options": {}
9
+ },
10
+ {
11
+ "files": ["typescript/*.ts"],
12
+ "options": {}
13
+ },
14
+ {
15
+ "files": ["ruby/*.rb"],
16
+ "options": {}
17
+ },
18
+ {
19
+ "files": ["java/*.java"],
20
+ "options": {}
21
+ }
22
+ ]
23
+ }
You can’t perform that action at this time.
0 commit comments