Update branch for triggering workflow #4
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@v2 | |
- name: Extract content from best_runs.md | |
run: | | |
sed -n '/<!--START_SECTION:best_runs-->/, /<!--END_SECTION:best_runs-->/p' results/best_runs.md > extracted_content.md | |
- name: Read README.md | |
id: readme_content | |
run: | | |
echo "::set-output name=content::$(cat README.md)" | |
- name: Update README | |
run: | | |
# Extract existing content between markers | |
existing_content=$(echo "${{ steps.readme_content.outputs.content }}" | sed -n '/<!--START_SECTION:best_runs-->/, /<!--END_SECTION:best_runs-->/p') | |
# Replace existing content with extracted content from best_runs.md | |
new_content=$(cat extracted_content.md) | |
updated_content=$(echo "${{ steps.readme_content.outputs.content }}" | sed "s@${existing_content}@${new_content}@") | |
# Write updated content back to README.md | |
echo "${updated_content}" > README.md |