diff --git a/.github/workflows/rails-ci.yml b/.github/workflows/rails-ci.yml index 0e0efd0..f59e919 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,14 @@ jobs: reporter: github-pr-check background: true + - name: Project Stats + id: project-stats + if: ${{ inputs.project_stats }} + uses: RoleModel/actions/project-stats@claude/project-stats-ci-integration-234e1e + 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 @@ -301,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 }}