feat: add automated issue response workflow using Codex

Adds GitHub Actions workflow to auto-respond to new issues using OpenAI's Codex action.

Features:
- Triggers on newly opened issues
- Skips issues with duplicate/spam/bot-skip labels or existing bot responses
- Includes comprehensive prompt for context-aware responses
- Enhanced security constraints and response format guidelines
- Checks for existing HAPI Bot responses before processing

Files:
- .github/workflows/issue-auto-response.yml - GitHub Actions workflow
- .github/prompts/issue-auto-response.md - Codex prompt with project context and guidelines
This commit is contained in:
weishu
2026-01-08 12:24:33 +08:00
parent 1665c63d95
commit 8f7547187f
2 changed files with 131 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
name: Issue Auto Response
on:
issues:
types: [opened]
concurrency:
group: issue-auto-response
cancel-in-progress: false
jobs:
auto-response:
if: |
!contains(github.event.issue.labels.*.name, 'duplicate') &&
!contains(github.event.issue.labels.*.name, 'spam') &&
!contains(github.event.issue.labels.*.name, 'bot-skip')
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Check for existing HAPI Bot response
id: check_bot
uses: actions/github-script@v7
with:
script: |
const marker = "*HAPI Bot*";
const allowedLogins = (process.env.HAPI_BOT_LOGINS || "github-actions[bot]")
.split(",")
.map((value) => value.trim())
.filter(Boolean);
const comments = await github.paginate(
github.rest.issues.listComments,
{
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
per_page: 100
}
);
const hasBot = comments.some(
(comment) => {
if (!(comment?.body || "").includes(marker)) {
return false;
}
const user = comment.user;
if (!user || user.type !== "Bot") {
return false;
}
return allowedLogins.includes(user.login);
}
);
core.setOutput("has_bot", hasBot ? "true" : "false");
if (hasBot) {
core.info("Existing HAPI Bot response found; skipping.");
}
env:
HAPI_BOT_LOGINS: ${{ vars.HAPI_BOT_LOGINS }}
- name: Checkout repository
if: steps.check_bot.outputs.has_bot != 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Codex for Issue Auto Response
if: steps.check_bot.outputs.has_bot != 'true'
uses: openai/codex-action@v1
env:
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
responses-api-endpoint: ${{ secrets.OPENAI_BASE_URL }}
model: ${{ vars.OPENAI_MODEL || 'gpt-5.2-codex' }}
effort: ${{ vars.OPENAI_EFFORT || 'high' }}
sandbox: danger-full-access
safety-strategy: drop-sudo
prompt-file: .github/prompts/issue-auto-response.md