Spaces:
Running
Running
name: Update Job Database | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Runs once a day at midnight | |
workflow_dispatch: # Allows manual triggering | |
permissions: | |
contents: write | |
jobs: | |
update-database: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Set timezone | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Europe/Stockholm" | |
- name: Run update script | |
env: | |
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} | |
run: python main.py | |
- name: Commit and push if timestamp changed | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add timestamp2.txt | |
git diff --quiet && git diff --staged --quiet || (git commit -m "Update timestamp" && git push) | |