File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 45
45
- name : Build Pandas
46
46
uses : ./.github/actions/build_pandas
47
47
48
+ - name : Set up maintainers cache
49
+ uses : actions/cache@v3
50
+ with :
51
+ path : maintainers.json
52
+ key : maintainers
53
+
48
54
- name : Build website
49
55
run : python web/pandas_web.py web/pandas --target-path=web/build
50
56
Original file line number Diff line number Diff line change 27
27
import collections
28
28
import datetime
29
29
import importlib
30
+ import json
30
31
import operator
31
32
import os
32
33
import pathlib
@@ -157,6 +158,18 @@ def maintainers_add_info(context):
157
158
Given the active maintainers defined in the yaml file, it fetches
158
159
the GitHub user information for them.
159
160
"""
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
+
160
173
repeated = set (context ["maintainers" ]["active" ]) & set (
161
174
context ["maintainers" ]["inactive" ]
162
175
)
@@ -171,6 +184,10 @@ def maintainers_add_info(context):
171
184
return context
172
185
resp .raise_for_status ()
173
186
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
+
174
191
return context
175
192
176
193
@staticmethod
You can’t perform that action at this time.
0 commit comments