Run Sprint Updates Bot #2
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: Run Sprint Updates Bot | |
on: | |
schedule: | |
- cron: '0 1 * * 1' # Every Monday at 1:00 AM UTC | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
generate-sprint-updates: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
# Check if today is a sprint start day | |
- name: Check if sprint start day | |
id: check_sprint_day | |
run: | | |
# Set the reference sprint start date (Sprint 29) | |
REF_DATE="2025-01-27" | |
CURRENT_DATE=$(date -u +'%Y-%m-%d') | |
# Calculate days since reference date | |
diff=$(( ( $(date -d "$CURRENT_DATE" +%s) - $(date -d "$REF_DATE" +%s) ) / 86400 )) | |
# Check if today is a sprint start day (diff should be divisible by 14) | |
if [ $(( diff % 14 )) -eq 0 ]; then | |
echo "This is a sprint start day." | |
echo "run_update=true" >> $GITHUB_OUTPUT | |
else | |
echo "Not a sprint start day. Exiting." | |
echo "run_update=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Install dependencies | |
if: steps.check_sprint_day.outputs.run_update == 'true' | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests openai slack_sdk certifi python-dotenv | |
- name: Run sprint updates bot | |
if: steps.check_sprint_day.outputs.run_update == 'true' | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} | |
ASSISTANT_ID: ${{ secrets.ASSISTANT_ID }} | |
run: python sprint-updates-bot.py |