This repository was archived by the owner on Feb 20, 2026. It is now read-only.
forked from nateraw/huggingface-sync-action
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
69 lines (60 loc) · 1.64 KB
/
Copy pathaction.yml
File metadata and controls
69 lines (60 loc) · 1.64 KB
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
60
61
62
63
64
65
66
67
68
69
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: alozowski
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: Prepare action sources
shell: bash
run: |
cp -r "$GITHUB_ACTION_PATH" cloned_hf_action_repo
- name: Checkout Source GitHub Repo to Push
uses: actions/checkout@v4
with:
repository: '${{ inputs.github_repo_id }}'
path: cloned_github_repo
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Push to hub
shell: bash
run: |
cd cloned_hf_action_repo
# Create virtual environment
uv venv .venv
# Install dependencies into venv
. .venv/bin/activate
uv pip install -r requirements.txt
cd ..
# Run script using venv Python
cloned_hf_action_repo/.venv/bin/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 }}"