Skip to content

fix(infra): selfhost 补服务间 URL,修 factor/data 容器内自连失败 #418

fix(infra): selfhost 补服务间 URL,修 factor/data 容器内自连失败

fix(infra): selfhost 补服务间 URL,修 factor/data 容器内自连失败 #418

Workflow file for this run

name: PR Assistant
# 在 PR/issue/review comment 里 @claude 触发 GLM-5.2 对话。
# 本 workflow 不阻塞 CI/CD,失败不影响 PR 合并。
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]
issues:
types: [opened, assigned]
jobs:
glm:
name: GLM-5.2 · @mention 触发
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Collect context
id: ctx
env:
GH_TOKEN: ${{ github.token }}
run: |
case "${{ github.event_name }}" in
issue_comment)
N="${{ github.event.issue.number }}"
{
echo "## Issue #$N"
gh issue view "$N" --json title,body --jq '"### \(.title)\n\n\(.body // "(no body)")"'
echo ""
echo "### @claude comment"
echo "${{ github.event.comment.body }}"
} > /tmp/glm_context.txt
echo "target=$N" >> $GITHUB_OUTPUT
echo "type=issue" >> $GITHUB_OUTPUT
;;
pull_request_review_comment)
N="${{ github.event.pull_request.number }}"
{
echo "## PR #$N Review Comment"
echo "File: ${{ github.event.comment.path }}"
echo ""
echo "### @claude comment"
echo "${{ github.event.comment.body }}"
} > /tmp/glm_context.txt
echo "target=$N" >> $GITHUB_OUTPUT
echo "type=pr" >> $GITHUB_OUTPUT
;;
pull_request_review)
N="${{ github.event.pull_request.number }}"
{
echo "## PR #$N Review"
echo ""
echo "### @claude comment"
echo "${{ github.event.review.body }}"
} > /tmp/glm_context.txt
echo "target=$N" >> $GITHUB_OUTPUT
echo "type=pr" >> $GITHUB_OUTPUT
;;
issues)
N="${{ github.event.issue.number }}"
{
echo "## Issue #$N"
echo "### ${{ github.event.issue.title }}"
echo ""
echo "### Body"
echo "${{ github.event.issue.body }}"
} > /tmp/glm_context.txt
echo "target=$N" >> $GITHUB_OUTPUT
echo "type=issue" >> $GITHUB_OUTPUT
;;
esac
- name: Call GLM-5.2
env:
ZHIPUAI_API_KEY: ${{ secrets.ZHIPUAI_API_KEY }}
CONTEXT_FILE: /tmp/glm_context.txt
run: |
export CONTEXT=$(cat "$CONTEXT_FILE")
python3 scripts/glm_mention.py
- name: Post reply
env:
GH_TOKEN: ${{ github.token }}
TARGET: ${{ steps.ctx.outputs.target }}
TYPE: ${{ steps.ctx.outputs.type }}
run: |
if [ ! -f /tmp/glm_reply.txt ]; then exit 0; fi
REPLY=$(cat /tmp/glm_reply.txt)
if [ "$TYPE" = "issue" ]; then
gh issue comment "$TARGET" --body "🤖 **GLM-5.2**: $REPLY"
else
gh pr comment "$TARGET" --body "🤖 **GLM-5.2**: $REPLY"
fi