mirror of
https://github.com/yamadashy/repomix.git
synced 2025-06-11 00:25:54 +03:00
99 lines
2.8 KiB
YAML
99 lines
2.8 KiB
YAML
name: "Repomix Action"
|
||
description: "Pack repository contents into a single file that is easy for LLMs to process"
|
||
author: "Kazuki Yamada <koukun0120@gmail.com>"
|
||
branding:
|
||
icon: archive
|
||
color: purple
|
||
|
||
inputs:
|
||
directories:
|
||
description: "Space-separated list of directories to process (defaults to '.')"
|
||
required: false
|
||
default: "."
|
||
include:
|
||
description: "Comma-separated glob patterns to include"
|
||
required: false
|
||
default: ""
|
||
ignore:
|
||
description: "Comma-separated glob patterns to ignore"
|
||
required: false
|
||
default: ""
|
||
output:
|
||
description: "Relative path to write packed file"
|
||
required: false
|
||
default: "repomix-output.xml"
|
||
compress:
|
||
description: "Set to 'false' to disable smart compression"
|
||
required: false
|
||
default: "true"
|
||
style:
|
||
description: "Output style (xml, markdown, plain)"
|
||
required: false
|
||
default: "xml"
|
||
additional-args:
|
||
description: "Any extra raw arguments to pass directly to the repomix CLI"
|
||
required: false
|
||
default: ""
|
||
repomix-version:
|
||
description: "Version (or tag) of the npm package to install – defaults to latest"
|
||
required: false
|
||
default: "latest"
|
||
|
||
runs:
|
||
using: "composite"
|
||
steps:
|
||
- name: Setup Node.js
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: "24"
|
||
cache: "npm"
|
||
- name: Install Repomix
|
||
shell: bash
|
||
run: |
|
||
npm install --global repomix@${{ inputs.repomix-version }}
|
||
- name: Run Repomix
|
||
id: build
|
||
shell: bash
|
||
run: |
|
||
set -e
|
||
# Using an array for safer command execution
|
||
# Safely split directories input into an array, handling spaces correctly
|
||
IFS=' ' read -r -a ARGS <<< "${{ inputs.directories }}"
|
||
|
||
if [ -n "${{ inputs.include }}" ]; then
|
||
ARGS+=(--include "${{ inputs.include }}")
|
||
fi
|
||
|
||
if [ -n "${{ inputs.ignore }}" ]; then
|
||
ARGS+=(--ignore "${{ inputs.ignore }}")
|
||
fi
|
||
|
||
if [ "${{ inputs.compress }}" = "false" ]; then
|
||
ARGS+=(--no-compress)
|
||
else
|
||
ARGS+=(--compress)
|
||
fi
|
||
|
||
if [ -n "${{ inputs.style }}" ]; then
|
||
ARGS+=(--style "${{ inputs.style }}")
|
||
fi
|
||
|
||
ARGS+=(--output "${{ inputs.output }}")
|
||
|
||
# Only add additional args if not empty
|
||
if [ -n "${{ inputs.additional-args }}" ]; then
|
||
# Use safer parsing for additional arguments
|
||
IFS=' ' read -r -a ADDITIONAL_ARGS <<< "${{ inputs.additional-args }}"
|
||
ARGS+=("${ADDITIONAL_ARGS[@]}")
|
||
fi
|
||
|
||
echo "Running: repomix ${ARGS[*]}"
|
||
repomix "${ARGS[@]}"
|
||
|
||
echo "output_file=${{ inputs.output }}" >> "$GITHUB_OUTPUT"
|
||
|
||
outputs:
|
||
output_file:
|
||
description: "Path to the file generated by Repomix"
|
||
value: ${{ steps.build.outputs.output_file }}
|