Skip to content

Sync Hugging Face App #27

Sync Hugging Face App

Sync Hugging Face App #27

name: Sync Hugging Face App
on:
workflow_dispatch:
jobs:
sync-hf:
runs-on: ubuntu-latest
permissions:
contents: write
env:
HF_USERNAME: 'DmitryRyumin'
HF_REPO: 'NewEraAI-Papers'
LOCAL_DIR: 'NewEraAI-Papers'
HF_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }}
JSON_DATA_PATH: 'json_data/2024/WACV'
steps:
- name: Checkout repository
uses: actions/checkout@v4
continue-on-error: true # Continue with the workflow even if the checkout fails
with:
ref: ${{ github.event.before || 'main' }}
- name: Install Git LFS
run: |
if [ ! -x "$(command -v git-lfs)" ]; then
echo "Git LFS is not installed. Installing ..."
sudo apt-get install git-lfs
fi
git lfs install
- name: Install colordiff
run: sudo apt-get install colordiff
- name: Set REMOTE_URL
run: |
echo "REMOTE_URL=https://${{ env.HF_USERNAME }}:${{ env.HF_TOKEN }}@huggingface.co/spaces/${{ env.HF_USERNAME }}/${{ env.HF_REPO }}" >> $GITHUB_ENV
- name: Clone Hugging Face Repository
run: |
GIT_LFS_SKIP_SMUDGE=1 git clone --quiet --branch=main --single-branch --depth=1 "$REMOTE_URL" "${{ env.LOCAL_DIR }}"
continue-on-error: true
- name: Display cloned directory contents
run: |
ls -al "${{ github.workspace }}/${{ env.LOCAL_DIR }}/${{ env.JSON_DATA_PATH }}"
- name: Define update_repo function
run: echo 'source ${{ github.workspace }}/scripts/update_repo.sh' > update_repo.sh
- name: Define compare_files function
run: echo 'source ${{ github.workspace }}/scripts/compare_files.sh' > compare_files.sh
- name: Compare and update files
run: bash compare_files.sh "${{ github.workspace }}/json_data" "${{ github.workspace }}/${{ env.LOCAL_DIR }}/${{ env.JSON_DATA_PATH }}"
- name: Update repository and commit
run: bash update_repo.sh "${{ github.workspace }}/${{ env.LOCAL_DIR }}/${{ env.JSON_DATA_PATH }}" "dl_03.03.1991@mail.ru" "DmitryRyumin" "${{ env.JSON_DATA_PATH }}" "${{ env.HF_USERNAME }}" "${{ env.HF_TOKEN }}" "${{ env.HF_REPO }}"