-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
60 lines (55 loc) · 1.62 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
60
name: Sync With Hugging Face Space
description: An action to sync files from a GitHub Repo to a Hugging Face Space and prepend the required YAML header to the README.
author: alex-bene
branding:
icon: upload-cloud
color: yellow
inputs:
github_repo_id:
required: true
type: string
github_branch:
type: string
default: "main"
yaml_header_path:
required: true
type: string
huggingface_repo_id:
required: true
type: string
hf_username:
required: true
type: string
hf_token:
required: true
type: string
runs:
using: "composite"
steps:
- name: Checkout Source GitHub Repo to Push
uses: actions/checkout@v4
with:
repository: '${{ inputs.github_repo_id }}'
ref: "${{ inputs.github_branch }}"
fetch-depth: 0
lfs: true
- name: Create new README
shell: bash
run: |
echo '---'|cat - ${{ inputs.yaml_header_path }} > README_sp.md ; \
echo -e '---\n'|cat - README.md >> README_sp.md ; \
rm README.md ; mv README_sp.md README.md
- name: Commit changes
shell: bash
run: |
git add README.md ; \
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git commit -m "Added yaml header on README for HF Space"
- name: Push to hub
shell: bash
env:
HF_USERNAME: ${{ inputs.hf_username }}
HF_TOKEN: ${{ inputs.hf_token }}
HF_REPO_ID: ${{ inputs.huggingface_repo_id }}
run: git push https://$HF_USERNAME:[email protected]/spaces/$HF_REPO_ID main