Skip to content

Commit 60da65a

Browse files
committed
refactor: Update discussion labeler workflow and clean up basic.py by removing unused private key path handling
1 parent 739e20d commit 60da65a

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed
Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,49 @@
1-
name: Label New Discussion
1+
name: Discussion Labeler
22

33
on:
4+
schedule:
5+
# Run every hour
6+
- cron: '0 * * * *'
7+
workflow_dispatch: # Allow manual triggering
48
discussion:
5-
types: [created]
9+
types: [created] # Add trigger for when a new discussion is created
10+
11+
# Use permissions directive to explicitly set token permissions
12+
permissions:
13+
contents: read
14+
discussions: write # Only needed to read/label discussions
615

716
jobs:
8-
label-discussion:
17+
label-discussions:
918
runs-on: ubuntu-latest
19+
1020
steps:
1121
- name: Checkout repository
12-
uses: actions/checkout@v4
13-
22+
uses: actions/checkout@v3
23+
1424
- name: Set up Python
15-
uses: actions/setup-python@v5
25+
uses: actions/setup-python@v4
1626
with:
17-
python-version: '3.11'
18-
27+
python-version: '3.10'
28+
1929
- name: Install dependencies
2030
run: |
2131
python -m pip install --upgrade pip
2232
pip install -r requirements.txt
23-
24-
- name: Copy .env file
25-
run: |
26-
if [ -f .env ]; then cp .env .env.workflow; fi
27-
33+
2834
- name: Run discussion labeler
2935
env:
30-
TOKEN: ${{ secrets.TOKEN }}
36+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
3137
APP_ID: ${{ secrets.APP_ID }}
3238
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
3339
APP_INSTALLATION_ID: ${{ secrets.APP_INSTALLATION_ID }}
40+
DEFAULT_REPO: ${{ github.repository }}
41+
REQUEST_TIMEOUT: "30"
42+
RUN_INTERVAL_MINUTES: "300"
43+
SECRET_KEY: ${{ secrets.SECRET_KEY }}
3444
AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}
3545
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
3646
AZURE_OPENAI_KEY: ${{ secrets.AZURE_OPENAI_KEY }}
37-
SECRET_KEY: ${{ secrets.SECRET_KEY }}
38-
DEFAULT_REPO: ${{ github.repository }}
3947
run: |
40-
python basic.py
48+
# Run once and exit (no need for continuous scheduling in GitHub Actions)
49+
python -c "import basic; basic.process_discussions()"

basic.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
import jwt # Added for GitHub App JWT generation
1313
from dotenv import load_dotenv
1414

15-
APP_PRIVATE_KEY_PATH = None
16-
17-
# get private key from args
18-
19-
if len(sys.argv) > 1:
20-
APP_PRIVATE_KEY_PATH = sys.argv[1]
21-
2215
# Optional imports for Azure components
2316
try:
2417
import prompty

0 commit comments

Comments
 (0)