Skip to content

Commit 9be49be

Browse files
authored
Merge pull request #26 from telexintegrations/staging
Staging
2 parents 11efa30 + 7851f9f commit 9be49be

File tree

3 files changed

+161
-42
lines changed

3 files changed

+161
-42
lines changed

README.md

Lines changed: 159 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,6 @@ Git Commit Quality Monitor analyzes commit messages in real-time, providing inst
2626
- GitHub repository access
2727
- Slack workspace (for notifications)
2828

29-
### Basic Setup
30-
31-
1. Clone the repository:
32-
```bash
33-
git clone <repository-url>
34-
cd commit-quality-monitor
35-
```
36-
37-
2. Set up a virtual environment:
38-
```bash
39-
python -m venv venv
40-
source venv/bin/activate # Linux/Mac
41-
# or
42-
.\venv\Scripts\activate # Windows
43-
```
44-
45-
3. Install dependencies:
46-
```bash
47-
pip install -r requirements.txt
48-
```
49-
50-
4. Configure environment variables:
51-
```bash
52-
cp .env.example .env
53-
# Edit .env with your configurations
54-
```
55-
56-
### Integration Setup
57-
58-
1. Configure repository webhooks with specific settings:
59-
- Go to your repository settings
60-
- Add webhook: `<your-app-url>/api/v1/webhook/github/{telex_channel_id}`
61-
- Set content type to `application/json`
62-
- Select "Just the push event"
63-
64-
2. Configure Slack notifications:
65-
- Create a Slack app
66-
- Add Incoming Webhooks
67-
- Add the generated webhook URL to your environment variables
68-
6929
## Detailed Configuration
7030

7131
| Variable | Description | Example |
@@ -255,11 +215,170 @@ You can customize the analyzer through Telex integration settings:
255215

256216
## Development Guide
257217

218+
### Basic Setup
219+
220+
1. Clone the repository:
221+
```bash
222+
git clone <repository-url>
223+
cd commit-quality-monitor
224+
```
225+
226+
2. Set up a virtual environment:
227+
```bash
228+
python -m venv venv
229+
source venv/bin/activate # Linux/Mac
230+
# or
231+
.\venv\Scripts\activate # Windows
232+
```
233+
234+
3. Install dependencies:
235+
```bash
236+
pip install -r requirements.txt
237+
```
238+
239+
4. Configure environment variables:
240+
```bash
241+
cp .env.example .env
242+
# Edit .env with your configurations
243+
```
244+
258245
### Running the Application
259246
```bash
260247
uvicorn main:app --reload
261248
```
262249

250+
### Telex Channel Setup
251+
252+
#### Step 1: Create Telex Channel
253+
1. Log into your Telex account
254+
2. Click on the ⊕ sign to add new channel
255+
3. Fill in channel details:
256+
- Name: "Commit Quality Monitor"
257+
4. Copy the channel ID - you'll need this for GitHub webhook setup
258+
259+
### GitHub Webhook Setup
260+
261+
#### Step 1: Access Repository Settings
262+
1. Go to your GitHub repository
263+
2. Click on "Settings" (requires admin access)
264+
- Located in the top menu bar
265+
- Look for the ⚙️ gear icon
266+
267+
#### Step 2: Navigate to Webhooks
268+
1. In the left sidebar, click on "Webhooks"
269+
2. Click the "Add webhook" button (top right)
270+
271+
#### Step 3: Configure Webhook
272+
1. Fill in the following fields:
273+
- Payload URL: `https://your-domain/api/v1/webhook/github/{telex_channel_id}`
274+
- Replace `your-domain` with your actual domain
275+
- Replace `{telex_channel_id}` with your Telex channel ID
276+
2. Set Content Type:
277+
- Select "application/json" from the dropdown menu
278+
3. Select Events:
279+
- Choose "Just the push event"
280+
- This ensures you only receive relevant commit notifications
281+
4. Check "Active":
282+
- Ensure the webhook is enabled
283+
5. Click "Add webhook" to save
284+
285+
#### Step 4: Verify Configuration
286+
1. Check the webhook in your repository settings
287+
2. Look for a green checkmark indicating successful configuration
288+
3. If you see a red X, check the "Recent Deliveries" tab for error details
289+
290+
### Slack Integration Setup
291+
292+
#### Step 1: Create Slack App
293+
1. Visit [Slack API Portal](https://api.slack.com/apps)
294+
2. Click "Create New App"
295+
3. Choose "From scratch"
296+
4. Fill in app details:
297+
- App Name: "Commit Quality Guardian"
298+
- Choose your workspace
299+
- Click "Create App"
300+
301+
#### Step 2: Configure Incoming Webhooks
302+
1. In your app's settings page:
303+
- Click "Incoming Webhooks" in the left sidebar
304+
- Toggle "Activate Incoming Webhooks" to `On`
305+
2. Add New Webhook:
306+
- Click "Add New Webhook to Workspace"
307+
- Choose the channel where notifications should appear
308+
- Click "Allow"
309+
3. Copy Webhook URL:
310+
- Find the new webhook URL in the list
311+
- Copy it - you'll need this for configuration in Telex
312+
- Format: `https://hooks.slack.com/services/XXX/YYY/ZZZ`
313+
314+
### Telex Integration Setup
315+
316+
#### Step 1: Add Integration to Channel
317+
1. In the left menu on your telex dashboard:
318+
- Click "Apps"
319+
- Click "Add New"
320+
- Enter the Integration JSON url: `https://your-domain/integration.json`
321+
2. Configure Integration:
322+
- Click on "Manage App" beside the added integration
323+
- Click on "Settings"
324+
- Add the slack webhook in the `slack_url` field
325+
- Clear defaults in `commit_types`, `example_commits`, and `training_data` fields; replace with custom values if necessary.
326+
327+
#### Step 3: Save and Activate
328+
1. Click "Save Settings"
329+
2. Enable the integration on the Apps dashboard
330+
331+
### Testing Your Integration
332+
333+
#### Step 1: Make a Test Commit
334+
1. Clone your repository:
335+
```bash
336+
git clone https://github.com/your-org/your-repo.git
337+
cd your-repo
338+
```
339+
2. Make a test commit:
340+
```bash
341+
# Make a change
342+
echo "test" > test.txt
343+
344+
# Add and commit
345+
git add test.txt
346+
git commit -m "add test file"
347+
348+
# Push changes
349+
git push origin main
350+
```
351+
352+
#### Step 2: Verify Notifications
353+
1. Check GitHub:
354+
- Go to repository settings
355+
- Click Webhooks
356+
- Look for successful delivery (green checkmark)
357+
2. Check Slack:
358+
- Go to your configured Slack channel
359+
- You should see a quality analysis message
360+
3. Check Telex:
361+
- Open your Telex channel
362+
- Verify the message was processed
363+
364+
### Troubleshooting
365+
366+
#### Common Issues and Solutions
367+
1. Webhook Not Triggering:
368+
- Verify webhook URL is correct
369+
- Check repository permissions
370+
- Ensure webhook is active
371+
2. Slack Messages Not Appearing:
372+
- Verify Slack webhook URL
373+
- Check app permissions in Slack
374+
- Ensure channel exists and is accessible
375+
- Check application logs for errors
376+
3. Telex Integration Issues:
377+
- Verify Telex channel ID
378+
- Check integration status in Telex
379+
- Ensure webhook URLs match
380+
- Verify settings configuration
381+
263382
### Testing
264383
```bash
265384
pytest tests/

src/config/icon.png

92.4 KB
Loading

src/config/integration_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ def generate_json_config():
66
return {
77
"data": {
88
"date": {
9-
"created_at": f"{datetime.now().isoformat()}",
10-
"updated_at": f"{datetime.now().isoformat()}"
9+
"created_at": f"{datetime.now().strftime("%-I:%M%p. %A, %B %-d, %Y.")}",
10+
"updated_at": f"{datetime.now().strftime("%-I:%M%p. %A, %B %-d, %Y.")}"
1111
},
1212
"descriptions": {
1313
"app_name": "GitHub Commit Quality Monitor",

0 commit comments

Comments
 (0)