-
Notifications
You must be signed in to change notification settings - Fork 33
57 lines (54 loc) · 2.04 KB
/
update-lambda-catalog.yml
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-lambda-catalog"
on:
schedule:
- cron: '00 */7 * * *' # Every 7 hours (coprimes with 24)
# The frequency can be tuned for the trade-off between
# freshness of the price and github action cost/user downloading
# overhead of the update.
# _UPDATE_FREQUENCY_HOURS in `lambda_catalog.py` need to be updated
# accordingly, if this is changed.
workflow_dispatch:
jobs:
update_lambda_catalog:
runs-on: ubuntu-latest
steps:
- name: Clone SkyPilot repo
uses: actions/checkout@v4
with:
repository: skypilot-org/skypilot
path: sky
- name: Clone Catalog repo
uses: actions/checkout@v4
with:
fetch-depth: 0
path: catalogs
token: ${{ secrets.GH_ACTION_PAT }}
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd sky
pip install ".[lambda]"
- name: Run fetch_lambda
run: |
version=$(python -c 'import sky; print(sky.clouds.service_catalog.constants.CATALOG_SCHEMA_VERSION)')
mkdir -p catalogs/catalogs/$version
cd catalogs/catalogs/$version
python -m sky.clouds.service_catalog.data_fetchers.fetch_lambda_cloud --api-key ${LAMBDA_API_KEY}
env:
LAMBDA_API_KEY: ${{ secrets.LAMBDA_API_KEY }}
- name: Commit catalog
run: |
version=$(python -c 'import sky; print(sky.clouds.service_catalog.constants.CATALOG_SCHEMA_VERSION)')
cd catalogs
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m"[Bot] Update Lambda catalog $version (scheduled at $(date))" || { echo "No changes to commit" && exit 0; }
git fetch origin
git rebase origin/master
git push