Update GitHub Discussions JSON #285
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: Update GitHub Discussions JSON | |
on: | |
schedule: | |
- cron: "0 */6 * * *" # Runs every 6 hours | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
update-discussions: | |
runs-on: ubuntu-latest | |
environment: "main" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.UPDATE_DISCUSSIONS_JSON_PAT }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Run load_github_discussions.py | |
env: | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: python scripts/load_github_discussions.py | |
- name: Commit and push if changed | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email 'action@github.com' | |
git add src/langfuse_github_discussions.json | |
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update langfuse_github_discussions.json" && git push origin ${GITHUB_REF#refs/heads/}) |