Update README content extraction #13
Workflow file for this run
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
name: Update README with best runs | |
on: | |
push: | |
branches: | |
- test | |
jobs: | |
update_readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 # Update to the latest version | |
# - 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 | |
- name: Update README | |
run: | | |
new_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-->}" | |
# 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 |