feat: add github action (#14) #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync to HF and ModelScope | |
| on: | |
| push: | |
| paths: | |
| - 'sft_model_eval/**' | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout current repo | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| fetch-depth: 0 | |
| - name: Setup Git and LFS | |
| run: | | |
| git config --global user.name "GitHub Action" | |
| git config --global user.email "action@github.com" | |
| git lfs install --skip-repo | |
| - name: Sync to HuggingFace | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| GIT_LFS_SKIP_SMUDGE=1 git clone "https://oauth2:$HF_TOKEN@huggingface.co/datasets/yj12869741/SeedBench" hf_repo | |
| cd hf_repo | |
| git config lfs.url "https://oauth2:$HF_TOKEN@huggingface.co/datasets/yj12869741/SeedBench.git/info/lfs" | |
| rm -rf one-shot zero-shot | |
| cp -r ../sft_model_eval/one-shot ../sft_model_eval/zero-shot . | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "No changes detected in HuggingFace repo" | |
| else | |
| echo "Changes detected, pushing to HuggingFace" | |
| git add . | |
| git commit -m "Update sft_model_eval from GitHub" | |
| git lfs push origin main | |
| git push origin main | |
| fi | |
| - name: Sync to ModelScope | |
| env: | |
| MODELSCOPE_TOKEN: ${{ secrets.MODELSCOPE_TOKEN }} | |
| run: | | |
| GIT_LFS_SKIP_SMUDGE=1 git clone "https://oauth2:$MODELSCOPE_TOKEN@www.modelscope.cn/datasets/y12869741/SeedBench.git" ms_repo | |
| cd ms_repo | |
| git config lfs.url "https://oauth2:$MODELSCOPE_TOKEN@www.modelscope.cn/datasets/y12869741/SeedBench.git/info/lfs" | |
| rm -rf one-shot zero-shot | |
| cp -r ../sft_model_eval/one-shot ../sft_model_eval/zero-shot . | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "No changes detected in ModelScope repo" | |
| else | |
| echo "Changes detected, pushing to ModelScope" | |
| git add . | |
| git commit -m "Update sft_model_eval from GitHub" | |
| git lfs push origin master | |
| git push origin master | |
| fi |