From 53b7d97145dde2cd352e860ddf470962a9a82e3e Mon Sep 17 00:00:00 2001 From: Wes Rich Date: Tue, 11 Aug 2026 10:51:20 -0400 Subject: [PATCH 1/4] Add optional project_stats input to rails-ci workflow Runs the project-stats action in the background right after gems are installed, reusing the workflow's existing Ruby setup instead of installing it a second time, so nothing waits on it and stats land in the job summary for free. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/rails-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/rails-ci.yml b/.github/workflows/rails-ci.yml index 0e0efd0..00201a2 100644 --- a/.github/workflows/rails-ci.yml +++ b/.github/workflows/rails-ci.yml @@ -44,6 +44,11 @@ on: type: string default: "17" + project_stats: + description: Run `bin/rails stats` and post the results to the job summary + type: boolean + default: false + rubocop_command: description: Rubocop command to run (omit to skip) type: string @@ -213,6 +218,13 @@ jobs: reporter: github-pr-check background: true + - name: Project Stats + if: ${{ inputs.project_stats }} + uses: RoleModel/actions/project-stats@v1 + with: + install-ruby: false + background: true + # Booting the app loads gems (poppler, vips, …) that dlopen the system # libraries from apt_packages, so app-booting steps must also wait on # install-apt — otherwise DB setup races the apt install and fails From f9c084d85e8c096ae230a00336287a64cc72e6e4 Mon Sep 17 00:00:00 2001 From: Wes Rich Date: Tue, 11 Aug 2026 13:28:13 -0400 Subject: [PATCH 2/4] Fix project-stats action ref (v1 predates the action) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RoleModel/actions/project-stats was added in v3.1.0, so it doesn't exist at v1 — pin to v3 instead, matching the rest of the workflow. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/rails-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rails-ci.yml b/.github/workflows/rails-ci.yml index 00201a2..0b92238 100644 --- a/.github/workflows/rails-ci.yml +++ b/.github/workflows/rails-ci.yml @@ -220,7 +220,7 @@ jobs: - name: Project Stats if: ${{ inputs.project_stats }} - uses: RoleModel/actions/project-stats@v1 + uses: RoleModel/actions/project-stats@v3 with: install-ruby: false background: true From b4b1b22bf611f99c04d315bc332be282ecf9337d Mon Sep 17 00:00:00 2001 From: Wes Rich Date: Tue, 11 Aug 2026 13:56:21 -0400 Subject: [PATCH 3/4] Publish Project Stats as its own Check Run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gives project_stats its own entry in the PR checks list, matching Test Results/brakeman, instead of being buried inside the ci job's step log. The stats table is still captured early as a background step (right after gems install) for zero added wall-clock time; only the lightweight Check Run publish is deferred to the end, grouped with the other end-of-run reporting steps. project-stats/action.yml keeps writing to $GITHUB_STEP_SUMMARY too, so its existing standalone usage (its own job, own summary) is unaffected — it now also exposes the table as a `table` output for callers that want to publish it elsewhere. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/rails-ci.yml | 25 +++++++++++++++++++++++++ project-stats/action.yml | 14 +++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rails-ci.yml b/.github/workflows/rails-ci.yml index 0b92238..4098412 100644 --- a/.github/workflows/rails-ci.yml +++ b/.github/workflows/rails-ci.yml @@ -219,6 +219,7 @@ jobs: background: true - name: Project Stats + id: project-stats if: ${{ inputs.project_stats }} uses: RoleModel/actions/project-stats@v3 with: @@ -313,6 +314,30 @@ jobs: name: rspec-screenshots path: ${{ inputs.failure-screenshot-dir }} + # Published here (grouped with the other end-of-run check runs) + # rather than right after Project Stats captures its output above, + # so it lands in the PR checks list alongside Test Results instead + # of appearing mid-install. + - name: Publish Project Stats Check + if: ${{ inputs.project_stats }} + uses: actions/github-script@v7 + env: + STATS_TABLE: ${{ steps.project-stats.outputs.table }} + with: + script: | + await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: 'Project Stats', + head_sha: context.payload.pull_request?.head.sha ?? context.sha, + status: 'completed', + conclusion: 'success', + output: { + title: 'Project Stats', + summary: process.env.STATS_TABLE, + }, + }) + - name: Cleanup uses: RoleModel/actions/test-cleanup@v1 with: diff --git a/project-stats/action.yml b/project-stats/action.yml index 4e1cd7c..1a574d6 100644 --- a/project-stats/action.yml +++ b/project-stats/action.yml @@ -18,6 +18,18 @@ runs: bundler-cache: true - name: Run Stats Command and Capture Output + id: run-stats shell: bash run: | - bin/rails stats | ${{ github.action_path }}/scripts/format-stats >> $GITHUB_STEP_SUMMARY + table="$(bin/rails stats | ${{ github.action_path }}/scripts/format-stats)" + echo "$table" >> "$GITHUB_STEP_SUMMARY" + { + echo "table<> "$GITHUB_OUTPUT" + +outputs: + table: + description: The Markdown table of `bin/rails stats` output + value: ${{ steps.run-stats.outputs.table }} From 1df71a58de6b6e138382d545b398b961e323ca72 Mon Sep 17 00:00:00 2001 From: Wes Rich Date: Tue, 11 Aug 2026 14:06:16 -0400 Subject: [PATCH 4/4] TEMP: point project-stats at this branch for verification Self-reference was still pinned to the released v3 tag, which doesn't have the new `table` output yet. Will revert to @v3 before merge. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/rails-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rails-ci.yml b/.github/workflows/rails-ci.yml index 4098412..f59e919 100644 --- a/.github/workflows/rails-ci.yml +++ b/.github/workflows/rails-ci.yml @@ -221,7 +221,7 @@ jobs: - name: Project Stats id: project-stats if: ${{ inputs.project_stats }} - uses: RoleModel/actions/project-stats@v3 + uses: RoleModel/actions/project-stats@claude/project-stats-ci-integration-234e1e with: install-ruby: false background: true