-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(actions): Add GitHub Action support #510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
180c54e
feat(actions): Add GitHub Action support
yamadashy cc69dfd
test(actions): Add matrix testing with multiple Node.js versions
yamadashy a435a1e
docs(readme): Move GitHub Action section to advanced usage
yamadashy aa39eac
docs(readme): Move GitHub Action section before library usage
yamadashy 0af58f2
docs(readme): Adjust GitHub Action section heading level and emoji po…
yamadashy d89603b
docs(readme): Make GitHub Action section title more descriptive
yamadashy d413594
docs(website): add GitHub Actions guide and sidebar links for all lan…
yamadashy 16e8da0
docs(readme): Enhance parameter descriptions for clarity and examples
yamadashy 72dd050
chore(action): Use array for safer command execution in Repomix
yamadashy 1357cb0
docs(website): Update output-file to output_file in documentation for…
yamadashy 465a79b
refactor(action): Safely split directories input into an array for co…
yamadashy 714a089
fix(action): Correct matrix syntax for test-case conditionals in work…
yamadashy 28ced0b
refactor(action): Use safer parsing for additional arguments in comma…
yamadashy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| 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.txt" | ||
| compress: | ||
| description: "Set to 'false' to disable smart compression" | ||
| required: false | ||
| default: "true" | ||
| 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: "22" | ||
| 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 | ||
|
|
||
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Test Repomix Action | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| paths: | ||
| - '.github/actions/repomix/**' | ||
|
|
||
| jobs: | ||
| test-action: | ||
| name: Test Node.js ${{ matrix.node-version }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| node-version: [18, 20, 22] | ||
| include: | ||
| - node-version: 18 | ||
| test-case: "minimal" | ||
| - node-version: 20 | ||
| test-case: "basic" | ||
| - node-version: 22 | ||
| test-case: "full" | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Run Repomix Action (Minimal) | ||
| if: matrix['test-case'] == 'minimal' | ||
| uses: ./.github/actions/repomix | ||
| with: | ||
| output: "repomix-minimal-output.txt" | ||
|
|
||
| - name: Run Repomix Action (Basic) | ||
| if: matrix['test-case'] == 'basic' | ||
| uses: ./.github/actions/repomix | ||
| with: | ||
| directories: "src" | ||
| include: "**/*.ts" | ||
| output: "repomix-basic-output.txt" | ||
| compress: "true" | ||
|
|
||
| - name: Run Repomix Action (Full) | ||
| if: matrix['test-case'] == 'full' | ||
| uses: ./.github/actions/repomix | ||
| with: | ||
| directories: "src tests" | ||
| include: "**/*.ts,**/*.md" | ||
| ignore: "**/*.test.ts" | ||
| output: "repomix-full-output.txt" | ||
| compress: "true" | ||
| additional-args: "--no-file-summary" | ||
|
|
||
| - name: Upload result | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: repomix-output-node${{ matrix.node-version }} | ||
| path: repomix-*-output.txt | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # Verwendung von Repomix mit GitHub Actions | ||
|
|
||
| Sie können den Verpackungsprozess Ihres Codebases für die KI-Analyse automatisieren, indem Sie Repomix in Ihre GitHub Actions Workflows integrieren. Dies ist nützlich für Continuous Integration (CI), Code-Reviews oder die Vorbereitung für LLM-Tools. | ||
|
|
||
| ## Grundlegende Nutzung | ||
|
|
||
| Fügen Sie den folgenden Schritt zu Ihrer Workflow-YAML-Datei hinzu, um Ihr Repository zu verpacken: | ||
|
|
||
| ```yaml | ||
| - name: Pack repository with Repomix | ||
| uses: yamadashy/repomix/.github/actions/repomix@main | ||
| with: | ||
| directories: src | ||
| include: "**/*.ts" | ||
| output: repomix-output.txt | ||
| ``` | ||
|
|
||
| ## Mehrere Verzeichnisse mit Komprimierung verpacken | ||
|
|
||
| Sie können mehrere Verzeichnisse, Include-/Exclude-Patterns und intelligente Komprimierung angeben: | ||
|
|
||
| ```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.txt | ||
| compress: true | ||
| ``` | ||
|
|
||
| ## Ausgabedatei als Artefakt hochladen | ||
|
|
||
| Um die verpackte Datei für nachfolgende Schritte oder zum Download bereitzustellen, laden Sie sie als Artefakt hoch: | ||
|
|
||
| ```yaml | ||
| - name: Pack repository with Repomix | ||
| uses: yamadashy/repomix/.github/actions/repomix@main | ||
| with: | ||
| directories: src | ||
| output: repomix-output.txt | ||
| compress: true | ||
|
|
||
| - name: Upload Repomix output | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: repomix-output | ||
| path: repomix-output.txt | ||
| ``` | ||
|
|
||
| ## Action-Eingabeparameter | ||
|
|
||
| | Name | Beschreibung | Standardwert | | ||
| |--------------------|----------------------------------------------|-------------------| | ||
| | `directories` | Zu verpackende Verzeichnisse (Leerzeichen-getrennt) | `.` | | ||
| | `include` | Einzuschließende Glob-Patterns (kommagetrennt) | `""` | | ||
| | `ignore` | Auszuschließende Glob-Patterns (kommagetrennt) | `""` | | ||
| | `output` | Pfad der Ausgabedatei | `repomix.txt` | | ||
| | `compress` | Intelligente Komprimierung aktivieren | `true` | | ||
| | `additional-args` | Zusätzliche Argumente für repomix CLI | `""` | | ||
| | `repomix-version` | Zu installierende npm-Paketversion | `latest` | | ||
|
|
||
| ## Action-Ausgaben | ||
|
|
||
| | Name | Beschreibung | | ||
| |---------------|-------------------------------------| | ||
| | `output_file` | Pfad zur generierten Ausgabedatei | | ||
|
|
||
| ## Komplettes Workflow-Beispiel | ||
|
|
||
| Hier ein vollständiges Beispiel für einen GitHub Actions Workflow mit Repomix: | ||
|
|
||
| ```yaml | ||
| name: Pack and Upload Codebase | ||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| pack: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Pack repository with Repomix | ||
| uses: yamadashy/repomix/.github/actions/repomix@main | ||
| with: | ||
| directories: src | ||
| include: "**/*.ts" | ||
| output: repomix-output.txt | ||
| compress: true | ||
| - name: Upload Repomix output | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: repomix-output | ||
| path: repomix-output.txt | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.