Merge pull request #155 from ilovenoah/create-pull-request/patch #51
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
# **************************************************************************** # | |
# # | |
# ::: :::::::: # | |
# clang-formatter.yml :+: :+: :+: # | |
# +:+ +:+ +:+ # | |
# By: taiphyyy <[email protected]> +#+ +:+ +#+ # | |
# +#+#+#+#+#+ +#+ # | |
# Created: 2023/09/02 15:36:37 by shtanemu #+# #+# # | |
# Updated: 2024/01/29 17:08:55 by taiphyyy ### ########.fr # | |
# # | |
# **************************************************************************** # | |
on: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
name: Clang-format Code Formatter | |
jobs: | |
lint: | |
name: clang-format Code Formatter | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: install tools | |
run: | | |
sudo apt update | |
sudo apt install clang-format | |
- name: Refactor codes | |
run: | | |
cd ./src | |
cpp_files=$(find . -type f -name '*.cpp') | |
for file in $cpp_files; do | |
echo "Running clang-format for $file..." | |
clang-format -i "$file" | |
done | |
cd .. | |
cd ./inc | |
hpp_files=$(find . -type f -name '*.hpp') | |
for file in $hpp_files; do | |
echo "Running clang-format for $file..." | |
clang-format -i "$file" | |
done | |
cd .. | |
- name: Remove unnecessary file | |
run: rm -f ".clang-fomat file" | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: Formatting by clang-format on Github actions | |
delete-branch: true | |
title: feature/formatting-by-clang-format-on-github-actions |