-
Notifications
You must be signed in to change notification settings - Fork 6
Add CI workflow to auto-update rolldown stats on main branch changes #27
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
Changes from 4 commits
ef18e66
9e2983a
09dd9e9
2de0ed4
175d262
63469e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: Update Rolldown Stats | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize] | ||
| paths: | ||
| - 'apps/dashboard/**' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| update-stats: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| ref: ${{ github.head_ref }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js LTS | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 'lts/*' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Get pnpm store directory | ||
| shell: bash | ||
| run: | | ||
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup pnpm cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ env.STORE_PATH }} | ||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm-store- | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Run rolldown stats collection | ||
| run: pnpm rolldown:stats | ||
|
|
||
| - name: Check for changes | ||
| id: git-check | ||
| run: | | ||
| if git diff --exit-code rolldown-version-stats.json; then | ||
| echo "No changes detected in rolldown-version-stats.json" | ||
| echo "changes=false" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "Changes detected in rolldown-version-stats.json" | ||
| echo "changes=true" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Commit and push changes | ||
Boshen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if: steps.git-check.outputs.changes == 'true' | ||
| run: | | ||
| git config --local user.email "[email protected]" | ||
|
||
| git config --local user.name "GitHub Action" | ||
|
||
| git add rolldown-version-stats.json | ||
| git commit -m "chore: update rolldown version stats" | ||
| git push origin HEAD:${{ github.head_ref }} | ||
|
|
||
| - name: No changes to commit | ||
| if: steps.git-check.outputs.changes != 'true' | ||
| run: echo "No changes were detected in rolldown-version-stats.json, skipping commit." | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot change to change on main branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the trigger to
pushon main branch instead ofpull_request. The workflow will now run when changes are pushed to the main branch. (63469e9)