stagger #29
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
| name: Update Repository Summary | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| # This ensures this workflow runs with proper concurrency management | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| update-repomix: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| # Need fetch-depth 0 to be able to push back | |
| fetch-depth: 0 | |
| # Need to have permissions to push back to the repo | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Run repomix | |
| run: npx repomix --output public/repo-summary.xml --style xml --parsable-style --header-text "" | |
| - name: Commit changes if any | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| # Check if there are any changes | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git add public/repo-summary.xml | |
| git commit -m "Update repository summary [skip ci]" | |
| # Handle different push scenarios for pull requests vs direct pushes | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| # For pull requests - push to the PR branch | |
| git push origin HEAD:${{ github.head_ref }} | |
| echo "Repository summary updated and pushed to PR branch." | |
| else | |
| # For direct pushes to main | |
| git push | |
| echo "Repository summary updated and pushed." | |
| fi | |
| else | |
| echo "No changes detected." | |
| fi |