Files
pr-comment-action/action.yml
2025-10-20 11:23:31 +00:00

42 lines
1.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: 'PR Comment'
description: '在 Gitea PR 上添加评论'
author: 'Your Name'
inputs:
body:
description: '评论内容'
required: true
token:
description: 'Gitea Token'
required: true
server:
description: 'Gitea 服务器地址(如 https://gitea.example.com'
required: true
owner:
description: '仓库所有者'
required: true
repo:
description: '仓库名称'
required: true
pr_number:
description: 'PR 编号'
required: true
runs:
using: "composite"
steps:
- name: Post Comment
shell: bash
run: |
BODY=$(cat <<'EOFMSG'
${{ inputs.body }}
EOFMSG
)
ESCAPED=$(echo "$BODY" | jq -Rs .)
curl -sS -X POST \
-H "Authorization: token ${{ inputs.token }}" \
-H "Content-Type: application/json" \
-d "{\"body\": $ESCAPED}" \
"${{ inputs.server }}/api/v1/repos/${{ inputs.owner }}/${{ inputs.repo }}/issues/${{ inputs.pr_number }}/comments"