Skip to content

Commit ca90b06

Browse files
feat: add Sentry error tracking to Python scripts
- Initialize sentry-sdk in update_schedule.py, extract_guest_metadata.py, generate_tts.py - Tag each script with its workflow name for easy filtering in Sentry - Pass SENTRY_DSN secret to all relevant workflow steps - Install sentry-sdk inline (no requirements.txt needed) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ecb5928 commit ca90b06

5 files changed

Lines changed: 32 additions & 1 deletion

File tree

.github/scripts/extract_guest_metadata.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
import urllib.request
1010
from datetime import datetime
1111

12+
import sentry_sdk
13+
14+
sentry_sdk.init(
15+
dsn=os.environ.get("SENTRY_DSN", ""),
16+
traces_sample_rate=0,
17+
environment="github-actions",
18+
)
19+
sentry_sdk.set_tag("workflow", "guest-promo-extract")
20+
1221
GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN", "")
1322
REPO = "githubevents/open-source-friday"
1423
HOST_NAMES = {

.github/scripts/generate_tts.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
import sys
88
import urllib.request
99

10+
import sentry_sdk
11+
12+
sentry_sdk.init(
13+
dsn=os.environ.get("SENTRY_DSN", ""),
14+
traces_sample_rate=0,
15+
environment="github-actions",
16+
)
17+
sentry_sdk.set_tag("workflow", "guest-promo-tts")
18+
1019
AZURE_TTS_KEY = os.environ.get("AZURE_TTS_KEY", "")
1120
AZURE_TTS_ENDPOINT = os.environ.get("AZURE_TTS_ENDPOINT", "")
1221
AZURE_TTS_VOICE = os.environ.get("AZURE_TTS_VOICE", "mai-voice-1")

.github/scripts/update_schedule.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
from urllib.request import Request, urlopen
1515
from urllib.error import HTTPError
1616

17+
import sentry_sdk
18+
19+
sentry_sdk.init(
20+
dsn=os.environ.get("SENTRY_DSN", ""),
21+
traces_sample_rate=0,
22+
environment="github-actions",
23+
)
24+
sentry_sdk.set_tag("workflow", "update-schedule")
25+
1726
REPO = "githubevents/open-source-friday"
1827
README_PATH = "README.md"
1928
START_MARKER = "<!-- SCHEDULE_START -->"

.github/workflows/guest-promo-pipeline.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,20 @@ jobs:
3838
- name: Extract guest metadata
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
4142
METADATA_OUTPUT: video/public/guest-promo.json
4243
run: |
4344
ISSUE=${{ github.event.issue.number || inputs.issue_number }}
4445
echo "Extracting metadata for issue #$ISSUE"
46+
pip install sentry-sdk --quiet
4547
python3 .github/scripts/extract_guest_metadata.py $ISSUE
4648
4749
- name: Generate TTS narration (MAI-Voice-1)
4850
env:
4951
AZURE_TTS_KEY: ${{ secrets.AZURE_TTS_KEY }}
5052
AZURE_TTS_ENDPOINT: ${{ secrets.AZURE_TTS_ENDPOINT }}
5153
AZURE_TTS_VOICE: ${{ secrets.AZURE_TTS_VOICE }}
54+
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
5255
METADATA_OUTPUT: video/public/guest-promo.json
5356
NARRATION_OUTPUT: video/public/narration.mp3
5457
run: python3 .github/scripts/generate_tts.py

.github/workflows/update-schedule.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ jobs:
3333
- name: Build schedule table and update README
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
run: python .github/scripts/update_schedule.py
36+
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
37+
run: pip install sentry-sdk --quiet && python .github/scripts/update_schedule.py
3738

3839
- name: Commit if changed
3940
run: |

0 commit comments

Comments
 (0)