Repository navigation
62 lines (56 loc) · 2.16 KB
/
Copy path_sync-folder.yml
File metadata and controls
62 lines (56 loc) · 2.16 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
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
permissions:
contents: read
jobs:
sync:
runs-on: ubuntu-latest
env:
REPO_ID: ${{ inputs.repo_id != '' && inputs.repo_id || format('uv-scripts/{0}', inputs.folder) }}
FOLDER: ${{ inputs.folder }}
REPO_TYPE: ${{ inputs.repo_type }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- 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 "$FOLDER" "$REPO_ID" "$REPO_TYPE"
- name: Guard — no LFS pointers (would corrupt Hub binaries)
run: |
if grep -rIl '^version https://git-lfs' "$FOLDER/"; then
echo "::error::LFS pointer file found in $FOLDER/ — would upload pointer text and corrupt the Hub asset"
exit 1
fi
- uses: huggingface/hub-sync@fdffea8e04104d0bd4e3181c5feb3025f0433ff5 # v0.3.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 }}