-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (45 loc) · 1.49 KB
/
update_readme.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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: Set Git Config
run: |
git config --global user.email "${{ secrets.MY_EMAIL }}"
git config --global user.name "${{ secrets.MY_NAME }}"
- name: Commit results if it changed
run: |
# if the results changed then commit the changes
if [[ $(git status --porcelain) ]]; then
git add results/best_runs.md
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: |
if [[ $(git status --porcelain) ]]; then
git add README.md
git commit -am "Update README with test results" || exit 0
git push
fi