Skip to content

GitHub ActionsでRepomixを使う

GitHub ActionsワークフローにRepomixを組み込むことで、AI解析用のコードベースパッキングを自動化できます。CIやコードレビュー、LLMツール向けの準備に便利です。

基本的な使い方

リポジトリをパックするには、ワークフローYAMLに以下のステップを追加します。

yaml
- name: Pack repository with Repomix
  uses: yamadashy/repomix/.github/actions/repomix@main
  with:
    output: repomix-output.xml

異なる出力形式の使用

styleパラメータを使用して異なる出力形式を指定できます(デフォルトはxmlです):

yaml
- name: Pack repository with Repomix
  uses: yamadashy/repomix/.github/actions/repomix@main
  with:
    output: repomix-output.md
    style: markdown

複数ディレクトリ・圧縮オプション

複数ディレクトリやinclude/excludeパターン、スマート圧縮も指定できます。

yaml
- name: Pack repository with Repomix
  uses: yamadashy/repomix/.github/actions/repomix@main
  with:
    directories: src tests
    include: "**/*.ts,**/*.md"
    ignore: "**/*.test.ts"
    output: repomix-output.xml
    compress: true

出力ファイルをアーティファクトとしてアップロード

生成したファイルを後続ステップやダウンロード用にアップロードする例です。

yaml
- name: Pack repository with Repomix
  uses: yamadashy/repomix/.github/actions/repomix@main
  with:
    directories: src
    output: repomix-output.xml
    compress: true

- name: Upload Repomix output
  uses: actions/upload-artifact@v4
  with:
    name: repomix-output
    path: repomix-output.xml

Actionの入力パラメータ

名前説明デフォルト
directoriesパック対象ディレクトリ(空白区切り).
include含めるファイルのglobパターン(カンマ区切り)""
ignore除外するファイルのglobパターン(カンマ区切り)""
output出力ファイルパスrepomix-output.xml
compressスマート圧縮の有効化true
style出力スタイル(xml, markdown, plain)xml
additional-argsrepomix CLIへの追加引数""
repomix-versionインストールするnpmパッケージのバージョンlatest

Actionの出力

名前説明
output_file生成された出力ファイルのパス

ワークフロー全体例

Repomixを使ったGitHub Actionsワークフローの例です。

yaml
name: Pack repository with Repomix

on:
  workflow_dispatch:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  pack-repo:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Pack repository with Repomix
        uses: yamadashy/repomix/.github/actions/repomix@main
        with:
          output: repomix-output.xml

      - name: Upload Repomix output
        uses: actions/upload-artifact@v4
        with:
          name: repomix-output.xml
          path: repomix-output.xml
          retention-days: 30

完全なワークフロー例をご参照ください。

Released under the MIT License.