Skip to content

Commit 54c73c5

Browse files
committed
refactor: extract configurable params to workflow file
1 parent ea6509a commit 54c73c5

5 files changed

Lines changed: 30 additions & 31 deletions

File tree

.github/workflows/pr-quality-check.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ jobs:
2020
MODEL: ${{ secrets.MODEL }}
2121
# Only API key for the chosen model is required
2222
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
23-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
2423
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
2625
# Obtained automatically by GH Actions
27-
AUTHOR_USERNAME: ${{ github.event.pull_request.user.login }}
2826
AUTHOR_ASSOCIATION: ${{ github.event.pull_request.author_association }}
27+
AUTHOR_USERNAME: ${{ github.event.pull_request.user.login }}
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
PR_BODY: ${{ github.event.pull_request.body }}
2930
PR_NUMBER: ${{ github.event.pull_request.number }}
30-
REPO_NAME: ${{ github.repository }}
3131
PR_TITLE: ${{ github.event.pull_request.title }}
32-
PR_BODY: ${{ github.event.pull_request.body }}
32+
REPO_NAME: ${{ github.repository }}
3333
run: python scripts/pr_checker_agent.py

.github/workflows/security-review.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@ jobs:
2828
- run: pip install litellm PyGithub
2929
- name: Run security review agent
3030
env:
31+
IGNORED_EXTENSIONS: .lock,.sum
32+
IGNORED_FILENAMES: package-lock.json,yarn.lock,poetry.lock,Gemfile.lock,Cargo.lock,composer.lock,pnpm-lock.yaml,pip.lock
33+
MAX_PATCH_CHARS_PER_FILE: 3000
3134
# e.g: "claude-sonnet-4-6", "gpt-4o", etc.
3235
MODEL: ${{ secrets.MODEL }}
3336
# Only API key for the chosen model is required
3437
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
35-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3638
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3840
# Obtained automatically by GH Actions
39-
REPO_NAME: ${{ github.repository }}
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4042
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
43+
REPO_NAME: ${{ github.repository }}
4144
TRIGGER: ${{ github.event_name }}
4245
run: python scripts/security_review_agent.py

.github/workflows/triage.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ jobs:
1616
- run: pip install litellm PyGithub
1717
- name: Run triage agent
1818
env:
19+
AVAILABLE_LABELS: automation,bug,dependencies,documentation,enhancement,good-first-issue,meeting,needs-info,plugins,protocol,question,security,tech-debt,testing
20+
LATEST_ISSUES_LIMIT: 100
1921
# e.g: "claude-sonnet-4-6", "gpt-4o", etc.
2022
MODEL: ${{ secrets.MODEL }}
2123
# Only API key for the chosen model is required
2224
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
23-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
2425
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
2627
# Obtained automatically by GH Actions
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
ISSUE_BODY: ${{ github.event.issue.body }}
2730
ISSUE_NUMBER: ${{ github.event.issue.number }}
28-
REPO_NAME: ${{ github.repository }}
2931
ISSUE_TITLE: ${{ github.event.issue.title }}
30-
ISSUE_BODY: ${{ github.event.issue.body }}
32+
REPO_NAME: ${{ github.repository }}
3133
run: python scripts/triage_agent.py

scripts/security_review_agent.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,19 @@
1818
if not any(os.environ.get(api_key) for api_key in valid_api_keys):
1919
raise ValueError("No API key is set")
2020

21+
IGNORED_FILENAMES = set(os.environ.get(
22+
"IGNORED_FILENAMES",
23+
"package-lock.json,yarn.lock,poetry.lock,Gemfile.lock,Cargo.lock,composer.lock,pnpm-lock.yaml,pip.lock"
24+
).split(","))
2125

22-
# Exclude files that are not useful for security analysis
23-
IGNORED_FILENAMES = {
24-
"package-lock.json",
25-
"yarn.lock",
26-
"poetry.lock",
27-
"Gemfile.lock",
28-
"Cargo.lock",
29-
"composer.lock",
30-
"pnpm-lock.yaml",
31-
"pip.lock",
32-
}
33-
34-
IGNORED_EXTENSIONS = {".lock", ".sum"}
26+
# Extensions must include a leading dot
27+
IGNORED_EXTENSIONS = set(os.environ.get(
28+
"IGNORED_EXTENSIONS",
29+
".lock,.sum"
30+
).split(","))
3531

3632
# Truncate very large diffs like generated files to prevent bloating the prompt
37-
MAX_PATCH_CHARS_PER_FILE = 3000
33+
MAX_PATCH_CHARS_PER_FILE = int(os.environ.get("MAX_PATCH_CHARS_PER_FILE", 3000))
3834

3935
# System prompt
4036

scripts/triage_agent.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
repo = gh.get_repo(os.environ["REPO_NAME"])
1010
issue = repo.get_issue(int(os.environ["ISSUE_NUMBER"]))
1111

12-
LATEST_ISSUES_LIMIT = 100
12+
LATEST_ISSUES_LIMIT = int(os.environ["LATEST_ISSUES_LIMIT"], 100)
13+
AVAILABLE_LABELS = os.environ.get("AVAILABLE_LABELS", "bug,enhancement,question,documentation,needs-info")
1314
MODEL = os.environ["MODEL"]
1415

1516
for env_var in ["GITHUB_TOKEN", "REPO_NAME", "ISSUE_NUMBER", "ISSUE_TITLE", "ISSUE_BODY", "MODEL"]:
@@ -29,10 +30,7 @@
2930
"name": "apply_label",
3031
"description": (
3132
"Apply one or more labels to the issue. "
32-
"Use labels like: automation, bug, dependencies, "
33-
"documentation, enhancement, good-first-issue, "
34-
"meeting, needs-info, plugins, protocol, question, "
35-
"security, tech-debt, testing."
33+
"Use labels like: " + AVAILABLE_LABELS
3634
),
3735
"parameters": {
3836
"type": "object",

0 commit comments

Comments
 (0)