Skip to content

Commit 6a39a5f

Browse files
author
leyangloh
committed
adding qualtrics bot
1 parent 105edef commit 6a39a5f

6 files changed

Lines changed: 1778 additions & 76 deletions

File tree

.github/workflows/progress-bot-enhanced.yml

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Enhanced Progress Bot
1+
name: GitHub Progress Bot
22

33
on:
44
push:
@@ -8,15 +8,8 @@ on:
88
milestone:
99
types: [created, edited, deleted, closed, opened]
1010
schedule:
11-
- cron: '0 9 * * 1' # Weekly on Monday 9 AM UTC
1211
- cron: '0 17 * * 5' # Weekly on Friday 5 PM UTC
1312
workflow_dispatch:
14-
inputs:
15-
test_mode:
16-
description: 'Run in test mode'
17-
required: false
18-
default: false
19-
type: boolean
2013

2114
jobs:
2215
run-progress-bot:
@@ -39,71 +32,68 @@ jobs:
3932
if [ -f requirements.txt ]; then
4033
pip install -r requirements.txt
4134
else
42-
echo "⚠️ No requirements.txt found, installing basic dependencies"
35+
echo "No requirements.txt found, installing basic dependencies"
4336
pip install requests
4437
fi
4538
4639
- name: Validate environment
4740
env:
4841
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4942
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
50-
SLACK_USER_ID: ${{ secrets.SLACK_USER_ID }}
43+
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
5144
run: |
52-
echo "🔍 Validating environment variables..."
45+
echo "Validating environment variables..."
5346
5447
if [ -z "$GITHUB_TOKEN" ]; then
55-
echo "GITHUB_TOKEN is not set"
48+
echo "GITHUB_TOKEN is not set"
5649
exit 1
5750
fi
5851
5952
if [ -z "$SLACK_BOT_TOKEN" ]; then
60-
echo "SLACK_BOT_TOKEN secret is not configured"
61-
echo "💡 Please add SLACK_BOT_TOKEN to repository secrets"
53+
echo "SLACK_BOT_TOKEN secret is not configured"
54+
echo "Please add SLACK_BOT_TOKEN to repository secrets"
6255
exit 1
6356
fi
6457
65-
if [ -z "$SLACK_USER_ID" ]; then
66-
echo "❌ SLACK_USER_ID secret is not configured"
67-
echo "💡 Please add SLACK_USER_ID to repository secrets"
58+
if [ -z "$SLACK_CHANNEL_ID" ]; then
59+
echo "SLACK_CHANNEL_ID secret is not configured"
60+
echo "Please add SLACK_CHANNEL_ID to repository secrets"
6861
exit 1
6962
fi
7063
71-
echo "All environment variables are configured"
64+
echo "All environment variables are configured"
7265
7366
- name: Run Progress Bot
7467
id: bot-run
7568
env:
7669
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7770
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
78-
SLACK_USER_ID: ${{ secrets.SLACK_USER_ID }}
71+
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
72+
GITHUB_REPO_OWNER: ${{ secrets.GITHUB_REPO_OWNER }}
73+
GITHUB_REPO_NAME: ${{ secrets.GITHUB_REPO_NAME }}
7974
run: |
80-
echo "🤖 Starting Human Augmented Analytics Group Progress Bot..."
81-
echo "📊 Repository: ${{ github.repository }}"
82-
echo "🔄 Trigger: ${{ github.event_name }}"
83-
echo "📅 Run time: $(date)"
75+
echo "Starting GitHub Progress Bot..."
76+
echo "Repository: ${{ github.repository }}"
77+
echo "Trigger: ${{ github.event_name }}"
78+
echo "Run time: $(date)"
8479
85-
if [ "${{ github.event.inputs.test_mode }}" == "true" ]; then
86-
echo "🧪 Running in TEST MODE"
87-
python advanced_progress_bot.py --test
88-
else
89-
echo "🚀 Running in PRODUCTION MODE"
90-
python advanced_progress_bot.py
91-
fi
80+
python progress_bot.py
9281
9382
- name: Report success
9483
if: success()
9584
run: |
96-
echo "Progress bot completed successfully!"
97-
echo "📈 Milestone data has been processed and sent to Slack"
98-
echo "🕐 Completed at: $(date)"
85+
echo "Progress bot completed successfully!"
86+
echo "Milestone data has been processed and sent to Slack"
87+
echo "Completed at: $(date)"
9988
10089
- name: Report failure
10190
if: failure()
10291
run: |
103-
echo "Progress bot failed!"
104-
echo "🔍 Check the logs above for error details"
105-
echo "💡 Common issues:"
92+
echo "Progress bot failed!"
93+
echo "Check the logs above for error details"
94+
echo "Common issues:"
10695
echo " - Missing or invalid Slack tokens"
96+
echo " - Missing SLACK_CHANNEL_ID secret"
10797
echo " - Network connectivity issues"
10898
echo " - GitHub API rate limits"
10999
echo " - Python dependency issues"
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Qualtrics Survey Bot
2+
3+
on:
4+
schedule:
5+
- cron: '0 17 * * 5' # Weekly on Friday 5 PM UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
run-qualtrics-bot:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.11'
21+
cache: 'pip'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
if [ -f requirements.txt ]; then
27+
pip install -r requirements.txt
28+
else
29+
echo "No requirements.txt found, installing basic dependencies"
30+
pip install requests
31+
fi
32+
33+
- name: Validate environment
34+
env:
35+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
36+
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
37+
QUALTRICS_CLIENT_ID: ${{ secrets.QUALTRICS_CLIENT_ID }}
38+
QUALTRICS_CLIENT_SECRET: ${{ secrets.QUALTRICS_CLIENT_SECRET }}
39+
QUALTRICS_DATACENTER: ${{ secrets.QUALTRICS_DATACENTER }}
40+
run: |
41+
echo "Validating environment variables..."
42+
43+
if [ -z "$SLACK_BOT_TOKEN" ]; then
44+
echo "SLACK_BOT_TOKEN secret is not configured"
45+
echo "Please add SLACK_BOT_TOKEN to repository secrets"
46+
exit 1
47+
fi
48+
49+
if [ -z "$SLACK_CHANNEL_ID" ]; then
50+
echo "SLACK_CHANNEL_ID secret is not configured"
51+
echo "Please add SLACK_CHANNEL_ID to repository secrets"
52+
exit 1
53+
fi
54+
55+
if [ -z "$QUALTRICS_CLIENT_ID" ]; then
56+
echo "QUALTRICS_CLIENT_ID secret is not configured"
57+
echo "Please add QUALTRICS_CLIENT_ID to repository secrets"
58+
exit 1
59+
fi
60+
61+
if [ -z "$QUALTRICS_CLIENT_SECRET" ]; then
62+
echo "QUALTRICS_CLIENT_SECRET secret is not configured"
63+
echo "Please add QUALTRICS_CLIENT_SECRET to repository secrets"
64+
exit 1
65+
fi
66+
67+
if [ -z "$QUALTRICS_DATACENTER" ]; then
68+
echo "QUALTRICS_DATACENTER secret is not configured"
69+
echo "Please add QUALTRICS_DATACENTER to repository secrets"
70+
exit 1
71+
fi
72+
73+
echo "All environment variables are configured"
74+
75+
- name: Run Qualtrics Bot
76+
id: bot-run
77+
env:
78+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
79+
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
80+
QUALTRICS_CLIENT_ID: ${{ secrets.QUALTRICS_CLIENT_ID }}
81+
QUALTRICS_CLIENT_SECRET: ${{ secrets.QUALTRICS_CLIENT_SECRET }}
82+
QUALTRICS_DATACENTER: ${{ secrets.QUALTRICS_DATACENTER }}
83+
run: |
84+
echo "Starting Qualtrics Survey Bot..."
85+
echo "Trigger: ${{ github.event_name }}"
86+
echo "Run time: $(date)"
87+
88+
python qualtrics_bot.py
89+
90+
- name: Report success
91+
if: success()
92+
run: |
93+
echo "Qualtrics bot completed successfully!"
94+
echo "Survey data has been processed and sent to Slack"
95+
echo "Completed at: $(date)"
96+
97+
- name: Report failure
98+
if: failure()
99+
run: |
100+
echo "Qualtrics bot failed!"
101+
echo "Check the logs above for error details"
102+
echo "Common issues:"
103+
echo " - Missing or invalid Slack tokens"
104+
echo " - Missing or invalid Qualtrics OAuth credentials"
105+
echo " - Invalid datacenter ID"
106+
echo " - Network connectivity issues"
107+
echo " - Qualtrics API rate limits"
108+
echo " - OAuth scope issues (needs manage:surveys)"
109+
110+
- name: Upload logs (on failure)
111+
if: failure()
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: qualtrics-bot-failure-logs
115+
path: |
116+
*.log
117+
/tmp/*.log
118+
retention-days: 7
119+
120+

0 commit comments

Comments
 (0)