+43
-54
@@ -1,64 +1,53 @@
|
||||
name: "PR Commenter Diff-Aware"
|
||||
description: "Post comments to changed lines in a PR based on a git diff, for GitHub or Gitea. Supports multiline templates."
|
||||
author: "Trez.One"
|
||||
|
||||
branding:
|
||||
icon: "paperclip"
|
||||
color: "blue"
|
||||
name: "PR Commenter for GitHub and Gitea"
|
||||
description: "Posts PR comments from large outputs like diffs, logs, or Terraform plans."
|
||||
author: "Your Name"
|
||||
inputs:
|
||||
platform:
|
||||
description: "Platform type: github or gitea"
|
||||
required: false
|
||||
default: "github"
|
||||
token:
|
||||
description: "Access token for the API"
|
||||
required: true
|
||||
pr_index:
|
||||
description: "Pull request number or index"
|
||||
required: true
|
||||
repo_owner:
|
||||
description: "Repository owner (default: GITHUB_REPOSITORY_OWNER)"
|
||||
required: false
|
||||
repo_name:
|
||||
description: "Repository name (default: GITHUB_REPOSITORY)"
|
||||
required: false
|
||||
api_url:
|
||||
description: "API URL for Gitea (default: GITHUB_API_URL)"
|
||||
required: false
|
||||
content:
|
||||
description: "Large text content (diff, log, plan, etc.)"
|
||||
required: false
|
||||
comment_template:
|
||||
description: "Template for the comment body (supports multiline and placeholders {line}, {lines})"
|
||||
required: false
|
||||
default: |
|
||||
Auto-comment:
|
||||
---
|
||||
{line}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
- name: Install Python dependencies
|
||||
run: pip install requests
|
||||
shell: bash
|
||||
|
||||
- name: Run PR commenter
|
||||
run: python comment_pr_diff.py
|
||||
shell: python
|
||||
- name: Run PR Commenter
|
||||
run: python3 ${{ github.action_path }}/comment_pr.py
|
||||
shell: bash
|
||||
env:
|
||||
PLATFORM: ${{ inputs.platform }}
|
||||
TOKEN: ${{ inputs.token }}
|
||||
API_URL: ${{ inputs.api_url || github.api_url }}
|
||||
REPO_OWNER: ${{ inputs.repo_owner || github.repository_owner }}
|
||||
REPO_NAME: ${{ inputs.repo_name || github.repository }}
|
||||
PR_INDEX: ${{ inputs.pr_index }}
|
||||
DIFF: ${{ inputs.diff }}
|
||||
COMMENT_TEMPLATE: ${{ inputs.comment_template }}
|
||||
|
||||
inputs:
|
||||
platform:
|
||||
description: "Target platform: github or gitea"
|
||||
required: true
|
||||
default: "github"
|
||||
token:
|
||||
description: "API token for authentication"
|
||||
required: true
|
||||
api_url:
|
||||
description: "Gitea API URL (only required for Gitea, e.g., https://gitea.example.com/api/v1)"
|
||||
required: false
|
||||
repo_owner:
|
||||
description: "Repository owner (user/org)"
|
||||
required: false
|
||||
repo_name:
|
||||
description: "Repository name"
|
||||
required: false
|
||||
pr_index:
|
||||
description: "PR number (GitHub) or index (Gitea)"
|
||||
required: true
|
||||
diff:
|
||||
description: "Git diff to parse (optional). If empty, posts only a general PR comment."
|
||||
required: false
|
||||
comment_template:
|
||||
description: |
|
||||
Multiline template for comment body.
|
||||
Use placeholders:
|
||||
- {line} → replaced by single changed line
|
||||
- {lines} → replaced by all added lines in the file
|
||||
required: false
|
||||
default: "Auto-comment: changed line -> {line}"
|
||||
REPO_OWNER: ${{ inputs.repo_owner }}
|
||||
REPO_NAME: ${{ inputs.repo_name }}
|
||||
API_URL: ${{ inputs.api_url }}
|
||||
CONTENT: ${{ inputs.content }}
|
||||
COMMENT_TEMPLATE: ${{ inputs.comment_template }}
|
||||
Reference in New Issue
Block a user