From 7912b3c782355fbbe839258fd5de308ca0ab8653 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 22:17:50 +0100 Subject: [PATCH] Update best runs in README.md --- .github/workflows/update_readme.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/update_readme.yml b/.github/workflows/update_readme.yml index 3023ee14..85104927 100644 --- a/.github/workflows/update_readme.yml +++ b/.github/workflows/update_readme.yml @@ -17,8 +17,7 @@ jobs: run: | # Read the content of best_runs.md file content=$(cat results/best_runs.md) - #print the content - echo "$content" + echo "$content" - name: Update README.md run: | @@ -26,20 +25,20 @@ jobs: readme_content=$(cat README.md) # Replace content between and - new_content=" \n $content \n " + new_content="\n$content\n" updated_readme_content=$(echo "$readme_content" | sed -e '//, //c\'"$new_content") # Update README.md echo "$updated_readme_content" > README.md - # commit the changes if there are any changes - if [ -n "$(git status --porcelain)" ]; then - # Commit and push changes - git config --global user.name "Md Mijanur Rahman" - git config --global user.email "md.rahman.ce@gmail.com" - git add README.md - git commit -m "Update best runs in README.md" - git push - else - echo "There are no changes in the README.md file" - fi \ No newline at end of file + # Check if there are changes in README.md + if ! git diff --quiet README.md; then + # Commit and push changes + git config --global user.name "Md Mijanur Rahman" + git config --global user.email "md.rahman.ce@gmail.com" + git add README.md + git commit -m "Update best runs in README.md" + git push + else + echo "There are no changes in the README.md file" + fi