Repository navigation
55 lines (50 loc) · 1.96 KB
/
Copy path_sync-folder.yml
File metadata and controls
55 lines (50 loc) · 1.96 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
name: _sync-folder
# Reusable: gate (superset) + LFS guard + hub-sync for one folder → a uv-scripts Hub repo.
# Per-repo callers (sync-<repo>.yml) invoke this; the logic lives here only.
# Defaults mirror a top-level folder to uv-scripts/<folder> as a dataset. The optional
# repo_id / repo_type let a folder map to a differently-named repo or a non-dataset repo
# (e.g. the org profile card: org-card/ → uv-scripts/README, a static Space).
on:
workflow_call:
inputs:
folder:
description: local top-level folder to mirror
required: true
type: string
repo_id:
description: target Hub repo id (default uv-scripts/<folder>)
required: false
type: string
default: ''
repo_type:
description: Hub repo type (dataset | space | model)
required: false
type: string
default: dataset
secrets:
HF_TOKEN:
required: true
jobs:
sync:
runs-on: ubuntu-latest
env:
REPO_ID: ${{ inputs.repo_id != '' && inputs.repo_id || format('uv-scripts/{0}', inputs.folder) }}
steps:
- uses: actions/checkout@v4
- name: Gate — folder must be a superset of the Hub repo (guards --delete="*")
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: bash ./tools/verify-superset.sh "${{ inputs.folder }}" "$REPO_ID" "${{ inputs.repo_type }}"
- name: Guard — no LFS pointers (would corrupt Hub binaries)
run: |
if grep -rIl '^version https://git-lfs' "${{ inputs.folder }}/"; then
echo "::error::LFS pointer file found in ${{ inputs.folder }}/ — would upload pointer text and corrupt the Hub asset"
exit 1
fi
- uses: huggingface/hub-sync@v0.2.0
with:
github_repo_id: ${{ github.repository }}
huggingface_repo_id: ${{ env.REPO_ID }}
repo_type: ${{ inputs.repo_type }}
subdirectory: ${{ inputs.folder }}
hf_token: ${{ secrets.HF_TOKEN }}