# ๐Ÿงฑ Git Auto Comment Action Automatically post comments or pull request reviews to **Gitea** or **GitHub**, with optional debug logging and diff parsing. --- ## ๐Ÿš€ Features - ๐Ÿงฉ Supports **GitHub** and **Gitea** - ๐Ÿ’ฌ Posts formatted PR comments or reviews - ๐Ÿชถ Uses `{line}` / `{lines}` placeholders in templates - ๐Ÿง  Parses diffs to include relevant code changes - ๐ŸŽจ Optional **colorized debug mode** --- ## ๐Ÿงฐ Inputs | Name | Required | Default | Description | |------|-----------|----------|-------------| | `platform` | No | `github` | Target platform (`github` or `gitea`) | | `token` | โœ… | โ€” | API token | | `repo_owner` | โœ… | โ€” | Repository owner | | `repo_name` | โœ… | โ€” | Repository name | | `pr_index` | โœ… | โ€” | Pull request index (Gitea) or issue number (GitHub) | | `api_url` | No | โ€” | Base API URL (required for Gitea) | | `diff` | No | โ€” | Diff or plan text to include in the comment | | `comment_template` | No | `"Auto-comment: changed line -> {line}"` | Template text. Supports `{line}` and `{lines}` placeholders | | `debug` | No | `false` | Enable verbose, colorized debug logs | --- ## ๐Ÿงฎ Example Usage ```yaml name: Auto PR Comment on: pull_request: types: [opened, synchronize] jobs: comment: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Post PR Comment uses: your-org/git-auto-comment@main with: platform: gitea token: ${{ secrets.GITEA_TOKEN }} repo_owner: "tar-valon" repo_name: "terraform-configs" pr_index: ${{ github.event.pull_request.number }} api_url: "https://gitea.example.com/api/v1" diff: | + added line one + added line two comment_template: | ๐Ÿงฑ **Terraform Plan Output** ``` {lines} ``` debug: "true" ``` ## ๐Ÿงฉ Debug Mode Set `debug: "true"` (or environment variable `DEBUG=true`) to enable verbose, colorized output: - Prints API endpoint, payload size, and preview - Truncates long payloads automatically - Highlights errors and successes in color ## ๐Ÿงช Local Testing ```bash export PLATFORM=gitea export TOKEN=your_token export REPO_OWNER=myorg export REPO_NAME=myrepo export PR_INDEX=42 export API_URL=https://gitea.example.com/api/v1 export COMMENT_TEMPLATE="Plan output:\n{lines}" export DIFF="$(git diff HEAD~1)" export DEBUG=true python git-auto-comment.py ```