Cost
Bundler cache, path filters, and job timeout keep Rails CI controlled.
A Ruby workflow with Bundler caching and Heroku deployment.
# Created by https://pipegrade.io# Template: Rails + Heroku + RSpec# Edit at https://pipegrade.io/github-actions/rails-heroku-rspec name: Rails CIon: # Run only when Rails app, config, database, or Bundler manifests change. push: branches: - main paths: - app/** - config/** - db/** - Gemfile - Gemfile.lock pull_request: paths: - app/** - config/** - db/** - Gemfile - Gemfile.lock permissions: # Keep GITHUB_TOKEN read-only; Heroku deploy uses HEROKU_API_KEY explicitly. contents: read concurrency: # Cancel outdated PR runs so only the newest commit spends CI minutes. group: rails-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test: # Bound Rails tests and asset compilation instead of relying on the platform limit. timeout-minutes: 25 runs-on: ubuntu-latest env: RAILS_ENV: test steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f with: ruby-version: '3.3' # setup-ruby installs gems and restores Bundler cache from Gemfile.lock. bundler-cache: true - run: bundle exec rails db:schema:load - run: bundle exec rspec - run: bundle exec rails assets:precompile # No artifacts are uploaded by default. If you add coverage or assets, set retention-days. - name: Deploy to Heroku if: github.ref == 'refs/heads/main' env: HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }} run: git push "https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git" HEAD:main - name: Notify on failure if: failure() run: echo "Send a failure notification to your team channel."Why it grades A
Bundler cache, path filters, and job timeout keep Rails CI controlled.
Actions are pinned to full commit SHAs and workflow permissions are read-only by default.
Build and test work is kept in one deterministic job unless the stack has a real dependency boundary.
Every job has timeout-minutes, a concurrency group, and clear deploy gating on main.
Already have a workflow?
Customize
Rules addressed
missing-dependency-cacheunpinned-actionmissing-top-level-permissionsmissing-path-filtersmissing-pr-cancel-concurrencymissing-timeout-minutesmissing-concurrency-groupmissing-failure-notificationRelated templates
Updates
These templates use reviewed action SHAs. Get notified when the template library expands.