-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathaction.yml
59 lines (55 loc) · 1.5 KB
/
action.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
58
59
name: Sync With Hugging Face Hub
description: An action to sync files on GitHub with a repo on the Hugging Face Hub (https://hf.co)
author: nateraw
branding:
icon: upload-cloud
color: yellow
inputs:
github_repo_id:
required: true
type: string
subdirectory:
type: string
default: ''
huggingface_repo_id:
required: true
type: string
hf_token:
required: true
repo_type:
type: string
default: 'space'
space_sdk:
type: string
default: 'gradio'
private:
type: boolean
default: false
runs:
using: "composite"
steps:
- name: Checkout Action GitHub Repo
uses: actions/checkout@v4
with:
repository: 'nateraw/spaces-action'
path: cloned_hf_action_repo
- name: Checkout Source GitHub Repo to Push
uses: actions/checkout@v4
with:
repository: '${{ inputs.github_repo_id }}'
# Relative path under $GITHUB_WORKSPACE to place the repository
path: cloned_github_repo
- name: Push to hub
shell: bash
run: |
cd cloned_hf_action_repo
git pull origin main
pip install -r requirements.txt
cd ..
python cloned_hf_action_repo/sync_with_spaces.py \
--repo_id ${{ inputs.huggingface_repo_id }} \
--directory "cloned_github_repo/${{ inputs.subdirectory }}" \
--token ${{ inputs.hf_token }} \
--repo_type ${{ inputs.repo_type }} \
--space_sdk ${{ inputs.space_sdk }} \
--private ${{ inputs.private }}