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