From 82434dc74f9cad2eac4e8ff718f2b98efbe7df94 Mon Sep 17 00:00:00 2001 From: Alexander Karan Date: Mon, 5 Jan 2026 15:30:45 +0800 Subject: [PATCH 1/2] Added Script to keep Docs Stats Updated --- .github/workflows/generate-stats.yml | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/generate-stats.yml diff --git a/.github/workflows/generate-stats.yml b/.github/workflows/generate-stats.yml new file mode 100644 index 0000000..05a08f3 --- /dev/null +++ b/.github/workflows/generate-stats.yml @@ -0,0 +1,57 @@ +name: Generate Stats + +on: + push: + branches: [main] + paths: + - 'packages/starter-*/**' + - 'package.json' + +jobs: + generate-stats: + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Generate stats + run: pnpm generate:stats + + - name: Format docs + run: pnpm --filter @framework-tracker/docs format + + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v8 + with: + commit-message: Update stats after starter changes + branch: automated-stats-update + delete-branch: true + title: 'Update stats after starter changes' + body: | + Automated stats update triggered by changes to starter packages. + + This PR was automatically created and will auto-merge if all checks pass. + + - name: Enable auto-merge + if: steps.cpr.outputs.pull-request-operation == 'created' + run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7c64524b85473d8d7209e669076cfd9a03e5def1 Mon Sep 17 00:00:00 2001 From: Alexander Karan Date: Mon, 5 Jan 2026 20:25:49 +0800 Subject: [PATCH 2/2] Updated --- .github/workflows/generate-stats.yml | 48 +++++++++++++++++++--------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/.github/workflows/generate-stats.yml b/.github/workflows/generate-stats.yml index 05a08f3..84acade 100644 --- a/.github/workflows/generate-stats.yml +++ b/.github/workflows/generate-stats.yml @@ -38,20 +38,38 @@ jobs: run: pnpm --filter @framework-tracker/docs format - name: Create Pull Request - id: cpr - uses: peter-evans/create-pull-request@v8 - with: - commit-message: Update stats after starter changes - branch: automated-stats-update - delete-branch: true - title: 'Update stats after starter changes' - body: | - Automated stats update triggered by changes to starter packages. - - This PR was automatically created and will auto-merge if all checks pass. - - - name: Enable auto-merge - if: steps.cpr.outputs.pull-request-operation == 'created' - run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}" + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Check if there are changes + if [[ -z $(git status -s) ]]; then + echo "No changes to commit" + exit 0 + fi + + # Create or switch to branch + git checkout -B automated-stats-update + + # Commit and push changes + git add . + git commit -m "Update stats after starter changes" + git push --force-with-lease origin automated-stats-update + + # Create PR if it doesn't exist + if ! gh pr view automated-stats-update &>/dev/null; then + gh pr create \ + --title "Update stats after starter changes" \ + --body "Automated stats update triggered by changes to starter packages. + + This PR was automatically created and will auto-merge if all checks pass." \ + --base main \ + --head automated-stats-update + else + echo "PR already exists, updated with new commits" + fi + + # Enable auto-merge + gh pr merge automated-stats-update --auto --squash env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}