Files
actions/comment-pr/action.yaml
Hugo Nijhuis 14d7cae864 Add reusable Forgejo Actions
Composite actions for CI/CD workflows:
- checkout: Clone repo with configurable depth
- docker-build: Build Docker images with multiple tags
- docker-push: Push to Forgejo Packages registry
- create-tag: Auto-increment semantic version tags
- create-issue: Create issues via Forgejo API
- create-pr: Create pull requests via Forgejo API
- comment-pr: Add comments to PRs via Forgejo API

All actions use shell scripts (no Node.js required).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 00:30:07 +01:00

44 lines
1.1 KiB
YAML

name: Comment on PR
description: Add a comment to a pull request via Forgejo API
inputs:
token:
description: Forgejo API token
required: true
repository:
description: Repository (owner/repo)
default: ${{ github.repository }}
pr-number:
description: Pull request number
required: true
body:
description: Comment body
required: true
outputs:
id:
description: Created comment ID
value: ${{ steps.comment.outputs.id }}
runs:
using: composite
steps:
- id: comment
shell: bash
run: |
TOKEN="${{ inputs.token }}"
REPO="${{ inputs.repository }}"
PR_NUMBER="${{ inputs.pr-number }}"
BODY="${{ inputs.body }}"
JSON=$(jq -n --arg body "$BODY" '{body: $body}')
RESPONSE=$(curl -s -X POST \
"https://code.flowmade.one/api/v1/repos/$REPO/issues/$PR_NUMBER/comments" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON")
ID=$(echo "$RESPONSE" | jq -r '.id')
echo "id=$ID" >> $GITHUB_OUTPUT