From adae176d2a235defd055200bc6d327949ba48c46 Mon Sep 17 00:00:00 2001 From: Krishna Vedala <7001608+kvedala@users.noreply.github.com> Date: Fri, 29 May 2020 17:22:51 -0400 Subject: [PATCH] auto rename files and auto format code --- .github/workflows/clang-format.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 4acf66536..e44869528 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -17,23 +17,30 @@ jobs: - uses: actions/checkout@master with: submodules: true - - name: Formatter + - name: Setup Git Specs + run: | + git config --global user.name github-actions + git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com' + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY + - name: Filename Formatter + for fname in $(find . -name '*.cpp' -o -name '*.h') + do + new_fname = tr ' ' '_' $fname + new_fname = tr 'A-Z' 'a-z' $fname + echo $new_fname + done + git commit -am "formatting filenames $GITHUB_SHA" || true + - name: Clang Formatter run: | for fname in $(find . -name '*.cpp' -o -name '*.h') do clang-format --verbose -i --style="$line1 $line2 $line3 $line4" "$fname" done + git commit -am "formatting source-code for $GITHUB_SHA" || true env: line1: "{ BasedOnStyle: Google, UseTab: Never," line2: "IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman," line3: "AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false," line4: "ColumnLimit: 80, AccessModifierOffset: -3 }" - - name: Commit files - run: | - cp -rp ./build/html/* . && rm -rf ./build && ls -lah - git config --global user.name github-actions - git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com' - git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY - git commit -am "formatting source-code for $GITHUB_SHA" || true - git push - + # -name: Git Push + # run: git push