Files
repomix-mirror/.github/actions/repomix/action.yml

114 lines
3.4 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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: orange
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@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "24"
- name: Install project dependencies
shell: bash
run: |
# Install project dependencies if package.json exists
# This ensures repomix.config.ts can import from local source
if [ -f "package.json" ]; then
npm install
fi
- name: Install Repomix
shell: bash
env:
REPOMIX_VERSION: ${{ inputs.repomix-version }}
run: |
npm install --global "repomix@${REPOMIX_VERSION}"
- name: Run Repomix
id: build
shell: bash
env:
INPUT_DIRECTORIES: ${{ inputs.directories }}
INPUT_INCLUDE: ${{ inputs.include }}
INPUT_IGNORE: ${{ inputs.ignore }}
INPUT_COMPRESS: ${{ inputs.compress }}
INPUT_STYLE: ${{ inputs.style }}
INPUT_OUTPUT: ${{ inputs.output }}
INPUT_ADDITIONAL_ARGS: ${{ inputs.additional-args }}
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 <<< "${INPUT_DIRECTORIES}"
if [ -n "${INPUT_INCLUDE}" ]; then
ARGS+=(--include "${INPUT_INCLUDE}")
fi
if [ -n "${INPUT_IGNORE}" ]; then
ARGS+=(--ignore "${INPUT_IGNORE}")
fi
if [ "${INPUT_COMPRESS}" = "true" ]; then
ARGS+=(--compress)
fi
if [ -n "${INPUT_STYLE}" ]; then
ARGS+=(--style "${INPUT_STYLE}")
fi
ARGS+=(--output "${INPUT_OUTPUT}")
# Only add additional args if not empty
if [ -n "${INPUT_ADDITIONAL_ARGS}" ]; then
# Use safer parsing for additional arguments
IFS=' ' read -r -a ADDITIONAL_ARGS <<< "${INPUT_ADDITIONAL_ARGS}"
ARGS+=("${ADDITIONAL_ARGS[@]}")
fi
echo "Running: repomix ${ARGS[*]}"
repomix "${ARGS[@]}"
echo "output_file=${INPUT_OUTPUT}" >> "$GITHUB_OUTPUT"
outputs:
output_file:
description: "Path to the file generated by Repomix"
value: ${{ steps.build.outputs.output_file }}