-
Notifications
You must be signed in to change notification settings - Fork 36
73 lines (65 loc) · 1.67 KB
/
update-stats.yml
File metadata and controls
73 lines (65 loc) · 1.67 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Update Stats
on:
schedule:
- cron: "0 */3 * * *" # every 3h
jobs:
do:
runs-on: ubuntu-latest
steps:
#
# Checkout the code
#
- uses: actions/checkout@v2
#
# Setup Python
#
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
#
# Install Pip dependencies
#
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
#
# Fetch updated PR stats into first/stats.json
#
- name: Fetch updates
run: ./scripts/update_stats.py first
#
# Update the stats tables in README.md
#
- name: Update stats Tables in Readme
run: ./scripts/generate_stats_table.py first
#
# Set git status env var
#
- name: Set git status env var
run: |
if git diff --exit-code
then
echo "git_has_diff=0" >> $GITHUB_ENV
else
echo "git_has_diff=1" >> $GITHUB_ENV
fi
#
# Commit the changes
#
- name: Commit Files
if: ${{ env.git_has_diff != 0 }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Add changes" -a
#
# Push to main
#
- name: Push changes
if: ${{ env.git_has_diff != 0 }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}