Skip to content

Commit a112f67

Browse files
committed
cleanup
1 parent 60da65a commit a112f67

File tree

6 files changed

+102
-351
lines changed

6 files changed

+102
-351
lines changed

#.env sample

Lines changed: 0 additions & 10 deletions
This file was deleted.

.env.sample

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1+
# GitHub credentials
2+
TOKEN=your-github-token-here
3+
14
# GitHub App credentials
2-
GITHUB_APP_ID=your-app-id-here
3-
GITHUB_APP_INSTALLATION_ID=your-installation-id-here
4-
GITHUB_APP_PRIVATE_KEY_PATH=./
5+
APP_ID=your-app-id-here
6+
APP_INSTALLATION_ID=your-installation-id-here
7+
APP_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----
8+
# Alternative: load key from file
9+
# APP_PRIVATE_KEY_PATH=./private-key.pem
510

611
# GitHub repo to monitor
712
DEFAULT_REPO=owner/repo-name
813

914
# How often to check for new discussions (in minutes)
10-
RUN_INTERVAL_MINUTES=600
15+
RUN_INTERVAL_MINUTES=60
1116

1217
# Request timeout in seconds
13-
REQUEST_TIMEOUT=30
18+
REQUEST_TIMEOUT=30
19+
20+
# Azure OpenAI settings for AI-based labeling
21+
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
22+
AZURE_OPENAI_KEY=your-api-key-here
23+
AZURE_OPENAI_API_VERSION=2023-09-15-preview
24+
25+
# Secret key for additional security (if needed)
26+
SECRET_KEY=your-secret-key-here

README.md

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,84 @@
1-
# discussions
2-
testing discussions feature
1+
# GitHub Discussion Auto-Labeler
2+
3+
Automatically labels GitHub discussions using AI to analyze content and apply appropriate tags.
4+
5+
## Features
6+
7+
- Automatically applies labels to new GitHub discussions
8+
- Uses Azure OpenAI for content analysis
9+
- Supports both GitHub token and GitHub App authentication
10+
- Can be run locally or as a GitHub Action
11+
- Includes a utility to create repository labels
12+
13+
## Setup
14+
15+
### Prerequisites
16+
17+
- Python 3.10+
18+
- GitHub token or GitHub App credentials
19+
- Azure OpenAI service (for AI-based labeling)
20+
21+
### Installation
22+
23+
1. Clone this repository
24+
2. Install dependencies:
25+
```bash
26+
pip install -r requirements.txt
27+
```
28+
3. Copy `.env.sample` to `.env` and fill in your credentials
29+
30+
### Environment Variables
31+
32+
| Variable | Description |
33+
|----------|-------------|
34+
| `TOKEN` | GitHub personal access token |
35+
| `APP_ID` | GitHub App ID |
36+
| `APP_PRIVATE_KEY` | GitHub App private key (content as string) |
37+
| `APP_INSTALLATION_ID` | GitHub App installation ID |
38+
| `DEFAULT_REPO` | Repository to monitor in format `owner/repo` |
39+
| `AZURE_OPENAI_ENDPOINT` | Azure OpenAI API endpoint |
40+
| `AZURE_OPENAI_KEY` | Azure OpenAI API key |
41+
| `AZURE_OPENAI_API_VERSION` | Azure OpenAI API version |
42+
| `RUN_INTERVAL_MINUTES` | How often to check for new discussions (in minutes) |
43+
44+
## Usage
45+
46+
### Running Locally
47+
48+
To run the script locally and continuously monitor for new discussions:
49+
50+
```bash
51+
python basic.py
52+
```
53+
54+
### Creating Repository Labels
55+
56+
To create the labels defined in `tags.json` in your repository:
57+
58+
```bash
59+
python new-labels.py
60+
```
61+
62+
### GitHub Action
63+
64+
This repo includes a GitHub Action workflow that automatically runs when new discussions are created.
65+
66+
To set up the GitHub Action:
67+
1. Configure repository secrets with the environment variables listed above
68+
2. The Action will run automatically when new discussions are created
69+
70+
## Customizing Labels
71+
72+
Edit the `tags.json` file to customize the available labels:
73+
74+
```json
75+
{
76+
"tags": [
77+
{"name": "label-name", "description": "Label description", "color": "hex-color"}
78+
]
79+
}
80+
```
81+
82+
## License
83+
84+
MIT

discussion_questions.md

Lines changed: 0 additions & 116 deletions
This file was deleted.

generate_discussions.py

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)