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>
This commit is contained in:
2025-12-25 23:16:20 +01:00
commit 14d7cae864
7 changed files with 379 additions and 0 deletions

73
create-issue/action.yaml Normal file
View File

@@ -0,0 +1,73 @@
name: Create Issue
description: Create an issue via Forgejo API
inputs:
token:
description: Forgejo API token
required: true
repository:
description: Repository (owner/repo)
default: ${{ github.repository }}
title:
description: Issue title
required: true
body:
description: Issue body
default: ''
labels:
description: Comma-separated label names
default: ''
assignees:
description: Comma-separated usernames to assign
default: ''
outputs:
number:
description: Created issue number
value: ${{ steps.create.outputs.number }}
url:
description: Issue URL
value: ${{ steps.create.outputs.url }}
runs:
using: composite
steps:
- id: create
shell: bash
run: |
TOKEN="${{ inputs.token }}"
REPO="${{ inputs.repository }}"
TITLE="${{ inputs.title }}"
BODY="${{ inputs.body }}"
LABELS="${{ inputs.labels }}"
ASSIGNEES="${{ inputs.assignees }}"
# Build JSON payload
JSON=$(jq -n \
--arg title "$TITLE" \
--arg body "$BODY" \
'{title: $title, body: $body}')
# Add labels if provided
if [ -n "$LABELS" ]; then
LABELS_JSON=$(echo "$LABELS" | tr ',' '\n' | jq -R . | jq -s .)
JSON=$(echo "$JSON" | jq --argjson labels "$LABELS_JSON" '. + {labels: $labels}')
fi
# Add assignees if provided
if [ -n "$ASSIGNEES" ]; then
ASSIGNEES_JSON=$(echo "$ASSIGNEES" | tr ',' '\n' | jq -R . | jq -s .)
JSON=$(echo "$JSON" | jq --argjson assignees "$ASSIGNEES_JSON" '. + {assignees: $assignees}')
fi
RESPONSE=$(curl -s -X POST \
"https://code.flowmade.one/api/v1/repos/$REPO/issues" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON")
NUMBER=$(echo "$RESPONSE" | jq -r '.number')
URL=$(echo "$RESPONSE" | jq -r '.html_url')
echo "number=$NUMBER" >> $GITHUB_OUTPUT
echo "url=$URL" >> $GITHUB_OUTPUT