-
Notifications
You must be signed in to change notification settings - Fork 54
38 lines (32 loc) · 1.17 KB
/
update-github-discussions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 '[email protected]'
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/})