Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/rails-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
14 changes: 13 additions & 1 deletion project-stats/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<PROJECT_STATS_EOF"
echo "$table"
echo "PROJECT_STATS_EOF"
} >> "$GITHUB_OUTPUT"

outputs:
table:
description: The Markdown table of `bin/rails stats` output
value: ${{ steps.run-stats.outputs.table }}