File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 4545 - name : Build Pandas
4646 uses : ./.github/actions/build_pandas
4747
48+ - name : Set up maintainers cache
49+ uses : actions/cache@v3
50+ with :
51+ path : maintainers.json
52+ key : maintainers
53+
4854 - name : Build website
4955 run : python web/pandas_web.py web/pandas --target-path=web/build
5056
Original file line number Diff line number Diff line change 2727import collections
2828import datetime
2929import importlib
30+ import json
3031import operator
3132import os
3233import pathlib
@@ -157,6 +158,18 @@ def maintainers_add_info(context):
157158 Given the active maintainers defined in the yaml file, it fetches
158159 the GitHub user information for them.
159160 """
161+ timestamp = time .time ()
162+
163+ cache_file = pathlib .Path ("maintainers.json" )
164+ if cache_file .is_file ():
165+ with open (cache_file ) as f :
166+ context ["maintainers" ] = json .load (f )
167+ # refresh cache after 1 hour
168+ if (timestamp - context ["maintainers" ]["timestamp" ]) < 3_600 :
169+ return context
170+
171+ context ["maintainers" ]["timestamp" ] = timestamp
172+
160173 repeated = set (context ["maintainers" ]["active" ]) & set (
161174 context ["maintainers" ]["inactive" ]
162175 )
@@ -171,6 +184,10 @@ def maintainers_add_info(context):
171184 return context
172185 resp .raise_for_status ()
173186 context ["maintainers" ][f"{ kind } _with_github_info" ].append (resp .json ())
187+
188+ with open (cache_file , "w" ) as f :
189+ json .dump (context ["maintainers" ], f )
190+
174191 return context
175192
176193 @staticmethod
You can’t perform that action at this time.
0 commit comments