Skip to content

Commit

Permalink
Update README with best runs
Browse files Browse the repository at this point in the history
  • Loading branch information
mijanr committed Mar 16, 2024
1 parent d61f567 commit b60ccae
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions .github/workflows/update_readme.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
name: Update README with best runs
name: Update README

on:
push:
branches:
- test
push:
branches:
- test

jobs:
update_readme:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3 # Update to the latest version
runs-on: ubuntu-latest # Use an Ubuntu environment

# - name: Extract content from best_runs.md
# id: extract_best_runs # Add an 'id' for later referencing
# run: |
# cat best_runs.md | sed -n '/<!--START_SECTION:best_runs-->/,/<!--END_SECTION:best_runs-->/p' | sed '1d;$d' > extracted_content.md
steps:
- uses: actions/checkout@v3 # Check out the code

- name: Update README
- name: Update README.md
run: |
new_content="$(cat results/best_runs.md)"
# Read the contents of best_runs.md
best_runs_content=$(cat results/best_runs.md)
if [[ -n "${new_content}" ]]; then
# Replace content between markers with new content
updated_content="${existing_content/<!--START_SECTION:best_runs-->*/<!--START_SECTION:best_runs-->\\${new_content}\\<!--END_SECTION:best_runs-->}"
# Replace the section in README.md (using delimiter to handle special characters)
sed -i '//,//c\\
'"$best_runs_content"'
\' README.md
# Commit changes to README.md
git config user.name "Md Mijanur Rahman"
git config user.email "[email protected]"
git add README.md
git commit -m "Automatic update: Best runs section"
git push
else
echo "No changes in best_runs.md; update skipped"
fi
# Commit and push the updated README.md
git config --global user.email "[email protected]"
git config --global user.name "Md Mijanur Rahman"
git commit -m "Automatic README update" README.md
git push

0 comments on commit b60ccae

Please sign in to comment.