Sync Endpoint #353
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Endpoint | |
on: | |
schedule: | |
- cron: '* */24 * * *' | |
jobs: | |
sync-to-hub: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Restore cache | |
id: file-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
sync/endpoint.txt | |
key: endpoint | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: run | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
ENDPOINTS: ${{ vars.ENDPOINTS }} | |
run: cd sync && pip install huggingface_hub && python sync.py && cat endpoint.txt | |
- name: Delete cache | |
run: | | |
gh extension install actions/gh-actions-cache | |
set +e | |
echo "Deleting cache..." | |
gh actions-cache delete endpoint -R ${{ github.repository }} --confirm | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Save cache | |
if: always() | |
id: file-save | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
sync/endpoint.txt | |
key: endpoint | |