-
Notifications
You must be signed in to change notification settings - Fork 2.3k
65 lines (54 loc) · 1.78 KB
/
format.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
name: Format Files
# cpp
# csharp - https://github.com/dotnet/format ?
# java - prettier-plugin-java
# javascript - prettier
# python - black
# ruby - rufo
# swift - https://github.com/apple/swift-format ?
# typescript - prettier
on:
# pull_request_target:
# types: [opened, synchronize]
workflow_dispatch:
jobs:
Format:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 1
- name: Use Node.js (dependency)
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install Rufo (dependency)
run: |
sudo apt update
sudo gem install rufo
- name: Install Prettier
run: |
npm install -g prettier
npm install -g prettier-plugin-java
- name: Install Black
uses: BSFishy/pip-action@v1
with:
packages: black
- name: Format
run: |
prettier --config "$GITHUB_WORKSPACE/.prettierrc" --write "$GITHUB_WORKSPACE/javascript/*.js" 2>&1 || true
prettier --config "$GITHUB_WORKSPACE/.prettierrc" --write "$GITHUB_WORKSPACE/typescript/*.ts" 2>&1 || true
prettier --config "$GITHUB_WORKSPACE/.prettierrc" --write "$GITHUB_WORKSPACE/java/*.java" 2>&1 || true
rufo "$GITHUB_WORKSPACE/ruby" 2>&1 || true
python -m black "$GITHUB_WORKSPACE/" 2>&1 || true
- name: Push
run: |
git config --global user.email "[email protected]"
git config --global user.name "Bot-A0"
git add .
git commit -m "🎨 Format files (🛠️ from Github Actions)" || true
git push || true