diff --git a/.github/workflows/update_readme.yml b/.github/workflows/update_readme.yml index 4845fb89..3ebd3c9a 100644 --- a/.github/workflows/update_readme.yml +++ b/.github/workflows/update_readme.yml @@ -15,10 +15,16 @@ jobs: run: | sed -n '//, //p' results/best_runs.md > extracted_content.md + - name: Read README.md + id: readme_content + run: | + cat README.md + echo "::set-output name=content::$(cat README.md)" + - name: Update README run: | - # Remove existing content between markers - sed -i '//,//d' README.md - - # Insert new content between markers - sed -i -e '//r extracted_content.md' README.md \ No newline at end of file + # Extract existing content between markers + existing_content=$(echo "${{ steps.readme_content.outputs.content }}" | sed -n '//, //p') + + # Replace existing content with extracted content from best_runs.md + sed -i "s@${existing_content}@$(cat extracted_content.md)@" README.md