branch set to main #10
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mlflow tabulate | |
- name: Run script | |
run: python results/gen_result.py | |
- name: Commit results if it changed | |
run: | | |
# if the results changed then commit the changes | |
if [[ $(git status --porcelain) ]]; then | |
git config --global user.email "[email protected]" | |
git config --global user.name "Md Mijanur Rahman" | |
git commit -am "Update results" || exit 0 | |
git push | |
fi | |
- name: Replace results in README | |
run: | | |
results=$(cat results/best_runs.md) # Read the results | |
# Replace the results in the README | |
awk -v r="$results" '/<!--START-->/ {print; print r; f=1} /<!--END-->/ {f=0} !f' README.md > temp && mv temp README.md | |
- name: Commit and push if it changed | |
run: | | |
git diff | |
git config --global user.email "[email protected]" | |
git config --global user.name "Md Mijanur Rahman" | |
git commit -am "Update README with test results" || exit 0 | |
git push |