Delete .env #101
This file contains 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 and Push to Hugging Face | |
on: | |
push: | |
branches: | |
- main # Trigger the workflow on push to the main branch | |
jobs: | |
sync-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- space_name: company-pet-policy | |
space_title: "Vectara pet policy" | |
space_description: "Ask questions about our unique pet policy" | |
- space_name: about-mls | |
space_title: "About MLS" | |
space_description: "Ask questions from the MLS About section" | |
- space_name: shakespeare | |
space_title: "Shakespeare and His Plays" | |
space_description: "Ask some basic questions about Shakespeare's work" | |
steps: | |
- name: Checkout Source Repository | |
uses: actions/checkout@v2 | |
- name: Set up SSH for Hugging Face | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Configure SSH known hosts for Hugging Face | |
run: | | |
mkdir -p ~/.ssh | |
ssh-keyscan hf.co >> ~/.ssh/known_hosts | |
- name: Set up Git configuration | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
- name: Clone and Pull Target Hugging Face Repository | |
run: | | |
git clone [email protected]:spaces/david-oplatka/${{ matrix.space_name }}.git $RUNNER_TEMP/spaces/${{ matrix.space_name }} | |
- name: Sync Source Repository with Temporary Folder | |
run: | | |
rsync -av --exclude '.*' $GITHUB_WORKSPACE/ $RUNNER_TEMP/spaces/${{ matrix.space_name }}/ | |
- name: commit changes | |
run: | | |
cd $RUNNER_TEMP/spaces/${{ matrix.space_name }} | |
sed -i 's/title: "Enter Chatbot Title"/title: ${{ matrix.space_name }}/g' README.md | |
sed -i 's/short_description: "Enter Description Here"/short_description: ${{ matrix.space_name }}/g' README.md | |
git add . | |
git commit -m "Sync updates from source repository" || echo "No changes to commit" | |
- name: Push changes to Hugging Face Space | |
env: | |
HF_ACCESS_TOKEN: ${{ secrets.HF_TOKEN }} # Replace with your actual secret name | |
run: | | |
cd $RUNNER_TEMP/spaces/${{ matrix.space_name }} | |
pwd | |
git push origin main |