From 473f17fb66d0b2e3dafd6bd19b95faa8cad02b2d Mon Sep 17 00:00:00 2001 From: Whisker17 Date: Fri, 28 Jul 2023 00:22:53 +0800 Subject: [PATCH] add prettier format --- .github/workflows/prettier_format.yml | 36 +++++++++++++++++++++++---- evaluations/AdMeta_1_0xCaso.md | 2 ++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prettier_format.yml b/.github/workflows/prettier_format.yml index 408437f418..29a0ba8246 100644 --- a/.github/workflows/prettier_format.yml +++ b/.github/workflows/prettier_format.yml @@ -16,18 +16,44 @@ jobs: - name: Install Prettier run: npm install prettier --global - - name: Format Files + - name: Check Commit History + run: git log --oneline + + - name: Check Current Branch + run: git rev-parse --abbrev-ref HEAD + + - name: Get Previous Commit + id: previous-commit run: | - prettier --write . + previous_commit=$(git log --skip 1 -n 1 --pretty=format:"%H") + echo "PREVIOUS_COMMIT=$previous_commit" >> $GITHUB_ENV + - name: Get Modified Files + id: modified-files + run: | + previous_commit=${{ env.PREVIOUS_COMMIT }} + modified_files=$(git diff --name-only $previous_commit ${{ github.sha }}) + echo "$modified_files" > modified_files.txt + + - name: Encode Modified Files + id: encode-modified-files + run: | + modified_files_encoded=$(base64 modified_files.txt) + echo "MODIFIED_FILES=$modified_files_encoded" >> $GITHUB_ENV + + - name: Format Modified Files + run: | + modified_files_encoded="${{ env.MODIFIED_FILES }}" + echo "$modified_files_encoded" | base64 --decode > modified_files.txt + prettier --list-different --parser [file-type] $(cat modified_files.txt) + - name: Commit Changes run: | git config --global user.name "Whisker17" git config --global user.email "demiwhisker@gmail.com" - git add . - git commit -m "Auto-format code with Prettier [skip ci]" + git commit -m "Auto-format code with Prettier [skip ci]" --amend --no-edit - name: Push Changes run: | branch_name=${{ github.ref }} - git push origin $branch_name \ No newline at end of file + git push origin $branch_name --force-with-lease diff --git a/evaluations/AdMeta_1_0xCaso.md b/evaluations/AdMeta_1_0xCaso.md index 05561f048d..fc44588af9 100644 --- a/evaluations/AdMeta_1_0xCaso.md +++ b/evaluations/AdMeta_1_0xCaso.md @@ -1,5 +1,7 @@ # Evaluation + + - **Status:** Accepted - **Application Document:** https://github.com/w3f/Grants-Program/blob/master/applications/AdMeta.md - **Milestone:** 1