|
| 1 | +name: RepoMix Vault Rollup |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths-ignore: |
| 7 | + - '_repomix-output/**' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + repomix-rollup: |
| 12 | + if: github.actor != 'github-actions[bot]' |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Check if last commit was auto-generated |
| 23 | + id: check_commit |
| 24 | + run: | |
| 25 | + LAST_COMMIT_MSG=$(git log -1 --pretty=format:'%s') |
| 26 | + if [[ "$LAST_COMMIT_MSG" == *"[skip ci]"* ]]; then |
| 27 | + echo "skip=true" >> $GITHUB_OUTPUT |
| 28 | + else |
| 29 | + echo "skip=false" >> $GITHUB_OUTPUT |
| 30 | + fi |
| 31 | +
|
| 32 | + - name: Create output directory |
| 33 | + if: steps.check_commit.outputs.skip != 'true' |
| 34 | + run: mkdir -p _repomix-output |
| 35 | + |
| 36 | + - name: Setup Bun |
| 37 | + if: steps.check_commit.outputs.skip != 'true' |
| 38 | + uses: oven-sh/setup-bun@v2 |
| 39 | + with: |
| 40 | + bun-version: latest |
| 41 | + |
| 42 | + - name: Install RepoMix |
| 43 | + if: steps.check_commit.outputs.skip != 'true' |
| 44 | + run: bun install -g repomix |
| 45 | + |
| 46 | + - name: Generate full vault rollup |
| 47 | + if: steps.check_commit.outputs.skip != 'true' |
| 48 | + run: | |
| 49 | + repomix \ |
| 50 | + --include "01-Primary-Categories/**/*.md,02-Secondary-Categories/**/*.md,03-Content/**/*.md" \ |
| 51 | + --output "_repomix-output/full-vault-rollup.md" \ |
| 52 | + --style markdown |
| 53 | +
|
| 54 | + - name: Generate sessions-only rollup |
| 55 | + if: steps.check_commit.outputs.skip != 'true' |
| 56 | + run: | |
| 57 | + repomix \ |
| 58 | + --include "03-Content/sessions/**/*.md" \ |
| 59 | + --output "_repomix-output/sessions-only.md" \ |
| 60 | + --style markdown |
| 61 | +
|
| 62 | + - name: Generate speakers-only rollup |
| 63 | + if: steps.check_commit.outputs.skip != 'true' |
| 64 | + run: | |
| 65 | + repomix \ |
| 66 | + --include "03-Content/speakers/**/*.md" \ |
| 67 | + --output "_repomix-output/speakers-only.md" \ |
| 68 | + --style markdown |
| 69 | +
|
| 70 | + - name: Check for changes |
| 71 | + if: steps.check_commit.outputs.skip != 'true' |
| 72 | + id: check_changes |
| 73 | + run: | |
| 74 | + git add _repomix-output/ |
| 75 | + if git diff --staged --quiet; then |
| 76 | + echo "has_changes=false" >> $GITHUB_OUTPUT |
| 77 | + else |
| 78 | + echo "has_changes=true" >> $GITHUB_OUTPUT |
| 79 | + fi |
| 80 | +
|
| 81 | + - name: Commit RepoMix outputs |
| 82 | + if: steps.check_commit.outputs.skip != 'true' && steps.check_changes.outputs.has_changes == 'true' |
| 83 | + run: | |
| 84 | + git config --local user.name "github-actions[bot]" |
| 85 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 86 | + git commit -m "[skip ci] Auto-update RepoMix vault rollups" |
| 87 | + git push |
0 commit comments