-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5592d66
commit deed84c
Showing
4 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
max_line_length = 300 | ||
indent_size = 4 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: formatter-all | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
jobs: | ||
formatter: | ||
name: formatter | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.label.name == 'format_all') }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
- name: Check exist lua files | ||
id: check_lua_files | ||
uses: andstor/file-existence-action@v2 | ||
with: | ||
files: "*.lua" | ||
- name: Install stylua and format files | ||
if: steps.check_lua_files.outputs.files_exists == 'true' | ||
uses: JohnnyMorganz/stylua-action@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
version: v0.18.0 | ||
args: -- . | ||
- name: Check exist web files | ||
id: check_web_files | ||
uses: andstor/file-existence-action@v2 | ||
with: | ||
files: "**/*.{ts,js,css,html}" | ||
- name: Format files with Prettier | ||
if: steps.check_web_files.outputs.files_exists == 'true' | ||
run: | | ||
npx prettier --write '**/*.{ts,js,css,html}' | ||
- name: Update repo before push | ||
run: | | ||
git pull | ||
- name: Commit changes and push current branch | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_user_name: BPT GITHUB ACTIONS BOT | ||
commit_user_email: bpt-github-actions-bot@users.noreply.github.com | ||
commit_message: :art:Code formatted in all files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: formatter-lua | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
jobs: | ||
formatter: | ||
name: formatter | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.label.name == 'format') }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v37 | ||
with: | ||
files: | | ||
**/*.lua | ||
!**/*.yml | ||
- name: List all changed files | ||
run: | | ||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | ||
echo "$file was changed" | ||
done | ||
- name: Install stylua | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
uses: JohnnyMorganz/stylua-action@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
version: v0.18.0 | ||
args: -- ${{ steps.changed-files.outputs.all_changed_files }} | ||
- name: Update repo before push | ||
run: | | ||
git pull | ||
- name: Commit changes and push current branch | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_user_name: BPT GITHUB ACTIONS BOT | ||
commit_user_email: bpt-github-actions-bot@users.noreply.github.com | ||
commit_message: :art:Code formatted in *.lua files | ||
file_pattern: '*.lua' | ||
status_options: '--untracked-files=no' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: formatter-prettier | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
jobs: | ||
formatter: | ||
name: formatter | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.label.name == 'format') }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v37 | ||
with: | ||
files: | | ||
**/*.{js,html,css} | ||
!**/*.yml | ||
!**/*.min.js | ||
- name: List all changed files | ||
run: | | ||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | ||
echo "$file was changed" | ||
done | ||
- name: Get file extensions | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
id: getext | ||
run: | | ||
import os | ||
files = '${{ steps.changed-files.outputs.all_changed_files }}'.split() | ||
extensions = set('*' + os.path.splitext(file)[1] for file in files) | ||
with open(os.getenv('GITHUB_ENV'), 'a') as f: | ||
f.write(f"CHANGED_EXTENSIONS={' '.join(extensions)}\n") | ||
shell: python | ||
- name: Format changed files with Prettier | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
run: | | ||
npx prettier --write ${{ steps.changed-files.outputs.all_changed_files }} | ||
- name: Update repo before push | ||
run: | | ||
git pull | ||
- name: Commit changed files and push current branch | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_user_name: BPT GITHUB ACTIONS BOT | ||
commit_user_email: bpt-github-actions-bot@users.noreply.github.com | ||
commit_message: :art:Code formatted in ${{ env.CHANGED_EXTENSIONS }} files | ||
file_pattern: ${{ env.CHANGED_EXTENSIONS }} | ||
status_options: '--untracked-files=no' |