Files
git-auto-comment/action.yml
T

63 lines
1.9 KiB
YAML

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"
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: pip install requests
- name: Run PR commenter
run: python comment_pr_diff.py
shell: python
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}"