Run rubyfmt as a GitHub Actions
PR check.
rubyfmt-action downloads a pinned, checksum-verified rubyfmt release and
runs it with --check, so your job fails whenever a pull request introduces
unformatted Ruby. No Ruby installation, gem, or Docker is required — the
action just needs curl and tar, which are present on GitHub-hosted
runners by default.
name: Ruby formatting
on:
pull_request:
branches: ["**"]
permissions:
contents: read
jobs:
rubyfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run rubyfmt
uses: rubyatscale/rubyfmt-action@v1If rubyfmt finds unformatted files, the job fails, the diff is printed to
the log, and (by default) added to the job summary.
Default: .
paths is a whitespace-separated list of files and/or directories for
rubyfmt to check.
- uses: rubyatscale/rubyfmt-action@v1
with:
paths: |
app/
lib/Default: latest
The version of rubyfmt to use. This can be latest or an exact version,
e.g. 0.14.2-10 (with or without a leading v). Only versions that have
been pinned in support/versions are accepted; see
Pinning a new version below.
Default: false
Whether rubyfmt should fail immediately on syntax/IO errors, instead of
warning and continuing.
Default: false
Whether to also check files that are excluded by .gitignore.
Default: none
Controls rubyfmt's magic header comment behavior:
none: check every input file (default)opt-in: only check files containing a# rubyfmt: trueheaderopt-out: skip files containing a# rubyfmt: falseheader
Default: true
Whether to write a diff of any unformatted files to the job summary
($GITHUB_STEP_SUMMARY).
Either success or failure, matching whether rubyfmt found any
unformatted files.
rubyfmt only publishes precompiled binaries for a subset of platforms, so
this action supports:
ubuntu-latest/ other Linux x86_64 runners- Linux aarch64 runners
macos-latest/ other Apple Silicon (arm64) runners
Intel Mac runners and Windows runners are not supported and will fail with a clear error.
This action only downloads rubyfmt releases whose checksums have been
pinned in support/versions, to avoid trusting a
release's contents sight-unseen at CI time. To pin a new release:
support/sync-versions.sh v0.15.0This downloads each platform's release asset, records its checksum in
support/versions, and marks the version as latest in
support/latest. Pass --historical to pin an older
release without changing what latest resolves to.
A self-hosted Renovate
job runs weekly and opens a PR bumping support/latest
when a new rubyfmt release is available, and similarly for the shellcheck
version pinned in ci.yml. Neither of those PRs
update the corresponding checksum(s) automatically (there's nothing for
Renovate to safely fetch a checksum from), so CI on those PRs fails until the
checksum is refreshed — run support/sync-versions.sh <tag> for rubyfmt,
or manually recompute and update SHELLCHECK_SHA256 for shellcheck.
Dependabot (see dependabot.yml) separately
handles the rest of this repo's GitHub Actions dependencies.
This project is licensed under the MIT License. See LICENSE for the full licensing terms.