diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f984734..70b4b29 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,21 +79,32 @@ jobs: runs-on: ubuntu-latest environment: release env: + INPUT_VERSION: ${{ inputs.version }} + INPUT_GEMSPEC_PATH: ${{ inputs.gemspec }} DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + GIT_USER_NAME: ${{ inputs.git-user-name }} + GIT_USER_EMAIL: ${{ inputs.git-user-email }} RUBYGEMS_OWNER_ID: ${{ inputs.rubygems-owner }} + TZ: ${{ inputs.timezone }} steps: - uses: actions/checkout@v7 id: checkout with: - persist-credentials: false + fetch-depth: 0 - uses: ruby/setup-ruby@v1 id: setup_ruby with: ruby-version: ${{ inputs.ruby-version }} bundler-cache: true + - name: Capture Release Context + id: capture_release_context + env: + RELEASE_STEP_ID: capture_release_context + run: bundle exec rake release:workflow:capture - name: Check Release Prerequisites id: check_release_prerequisites env: + GH_TOKEN: ${{ github.token }} RELEASE_STEP_ID: check_release_prerequisites run: bundle exec rake release:workflow:preflight release: @@ -135,6 +146,7 @@ jobs: - name: Check Release Prerequisites id: check_release_prerequisites env: + GH_TOKEN: ${{ github.token }} RELEASE_STEP_ID: check_release_prerequisites run: bundle exec rake release:workflow:preflight - name: Validate Release diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b10cd4..a5e1a20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - [#82](https://github.com/dblock/ruby-gem-release/pull/82): Create the default package and Git temporary directories only when release data is first used, so loading a workflow leaves none behind - [@dblock](https://github.com/dblock). - [#83](https://github.com/dblock/ruby-gem-release/pull/83): Name Intridea subsections with `sections:`, dropping sections without notes from a release and starting every Next section with all of them - [@dblock](https://github.com/dblock). - [#85](https://github.com/dblock/ruby-gem-release/pull/85): Verify RubyGems Trusted Publishing before every release with a `release:workflow:preflight` task, add a `dry-run` workflow input that runs only that check, and name the token claims in rejected exchanges - [@dblock](https://github.com/dblock). +- [#86](https://github.com/dblock/ruby-gem-release/pull/86): Check that the release token can push to the default branch and that no repository rules would reject the release commit or tag before every release - [@dblock](https://github.com/dblock). - Your contribution here. ## 0.7.0 (2026/11/20) diff --git a/README.md b/README.md index 68637ef..5f87cb2 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Collaborators with write access can dispatch releases after this setup, without ### 4. Make a Release -Your branch rules must permit release commits and tags to be pushed; see [branch permissions](RELEASING.md#one-time-setup). Dispatching starts a publishing run; when required reviewers are configured, the release job waits for approval from a designated maintainer. Run your project's tests and build checks, review the changes, and dispatch from your default branch: +Your branch rules must permit release commits and tags to be pushed; see [branch permissions](RELEASING.md#one-time-setup). Each release checks this before publishing. Dispatching starts a publishing run; when required reviewers are configured, the release job waits for approval from a designated maintainer. Run your project's tests and build checks, review the changes, and dispatch from your default branch: **First release:** Pass the numeric RubyGems account ID shown on the Pending Trusted Publishers page as `rubygems-owner`. This declares the account that will own the gem on its first publication. Replace `YOUR_ACCOUNT_ID` below with that ID: diff --git a/action.yml b/action.yml index fac49f1..7154bf6 100644 --- a/action.yml +++ b/action.yml @@ -100,6 +100,7 @@ runs: id: check_release_prerequisites shell: bash env: + GH_TOKEN: ${{ github.token }} RELEASE_STEP_ID: check_release_prerequisites run: bundle exec rake release:workflow:preflight - name: Validate Release diff --git a/docs/actions/action.md b/docs/actions/action.md index db1a32d..bc33a90 100644 --- a/docs/actions/action.md +++ b/docs/actions/action.md @@ -68,7 +68,7 @@ Register a RubyGems trusted publisher for the calling repository, its own workfl For maintainer-only publication, protect the caller job's `release` environment using [Maintainer-Approved Publication](../../RELEASING.md#maintainer-approved-publication). Other repository writers can dispatch, but publication waits for a designated maintainer to approve. Environments do not restrict who can dispatch, and an environment without protection rules does not restrict release access. -The action checks [release prerequisites](release.md#release-prerequisites), including the trusted publisher, after context capture and before validation, edits, or publication. To check without releasing, run `bundle exec rake release:workflow:preflight` in a job of the same workflow file, in the `release` environment, with `id-token: write`. RubyGems matches the workflow file and environment, so a check from another workflow or environment does not prove the release job's configuration. The composite action has no dry-run input. +The action checks [release prerequisites](release.md#release-prerequisites), including the trusted publisher and the token's ability to push the release commit and tag, after context capture and before validation, edits, or publication. To check without releasing, run `bundle exec rake release:workflow:preflight` in a job of the same workflow file, in the `release` environment, with `id-token: write`. RubyGems matches the workflow file and environment, so a check from another workflow or environment does not prove the release job's configuration. The composite action has no dry-run input. For first publication, register a pending trusted publisher and supply its numeric account ID through `rubygems-owner`. Later publications can omit that input. The default `release:publish` task authenticates through the configured destination before invoking its publication callback; no separate YAML authentication step is needed. The RubyGems destination uses the [Ruby credentials helper](../workflow/ruby_gems_credentials.md) without a stored API key. It exports environment variables and does not create or modify `~/.gem/credentials`. Command overrides that bypass the task must own authentication as well as publication. diff --git a/docs/actions/release.md b/docs/actions/release.md index 978c66d..1430956 100644 --- a/docs/actions/release.md +++ b/docs/actions/release.md @@ -34,9 +34,11 @@ Identity values must be nonempty and contain no line breaks. They change commit Every release runs `bundle exec rake release:workflow:preflight` after context capture, before validation, edits, or publication, so missing permissions fail before anything is pushed or published. The preflight requests the job's OIDC token and exchanges it at RubyGems exactly as publication does, passing `rubygems-owner` when set. Success proves that the caller granted `id-token: write` and that a trusted publisher matches the repository, workflow, and environment in the token. The job reports those claims and the credential's scopes; on failure, the error names the claims RubyGems rejected. The exchanged credential is masked, expires after 15 minutes, and is never exported or used; publication performs its own exchange. RubyGems does not report which gems a publisher is attached to, so the preflight cannot confirm that the publisher belongs to this gem, or that RubyGems would accept the package. +On GitHub Actions, the preflight also checks that the job's token can push the release. `git push --dry-run` to the default branch fails without `contents: write`; GitHub requires push access to start a push, and a dry run sends no objects and changes no refs. It then reads the [repository rules](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets) that apply to the default branch and to the `vVERSION` release tag. Branch rules requiring pull requests, status checks, signed commits, deployments, a merge queue, or restricting updates, and tag rules restricting creation or requiring signatures, fail the preflight unless the ruleset reports that the token can bypass it. Classic branch protection rules are not readable without admin access, so a protected default branch produces a warning instead. + ### Dry Run -Set `dry-run: true` to run only the release prerequisites. A separate `preflight` job runs instead of the `release` job, in the same `release` environment, so required reviewers still approve it. It checks out the caller without persisted credentials, installs the bundle, and runs the same [prerequisite checks](#release-prerequisites). It never edits files, commits, tags, pushes, builds, or publishes. +Set `dry-run: true` to run only the release prerequisites. A separate `preflight` job runs instead of the `release` job, in the same `release` environment, so required reviewers still approve it. It checks out the caller, installs the bundle, captures the release context, and runs the same [prerequisite checks](#release-prerequisites). It never edits files, commits, tags, pushes, builds, or publishes. To dispatch dry runs, add a boolean input to the caller and pass it through: diff --git a/docs/tasks.md b/docs/tasks.md index 64ed901..cb5ddcc 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -62,6 +62,6 @@ The [Detailed Usage example](usage.md#custom-callbacks) commits, builds, tags, p ## Workflow Credentials -`release:workflow:preflight` checks release prerequisites without editing files, pushing, or publishing. With a RubyGems destination it verifies Trusted Publishing through [`Workflow::RubyGemsCredentials#check!`](workflow/ruby_gems_credentials.md#check) with optional `RUBYGEMS_OWNER_ID`; other destinations skip that check. Both Actions interfaces run it in every release after context capture, and the reusable workflow runs only it for [dry runs](actions/release.md#dry-run). +`release:workflow:preflight` checks release prerequisites without editing files, pushing, or publishing. With a RubyGems destination it verifies Trusted Publishing through [`Workflow::RubyGemsCredentials#check!`](workflow/ruby_gems_credentials.md#check) with optional `RUBYGEMS_OWNER_ID`; other destinations skip that check. On GitHub Actions it also checks that the token can push to `DEFAULT_BRANCH` and that no repository rules it cannot bypass would reject the release commit or `vVERSION` tag, using `INPUT_VERSION` or the captured `GEMSPEC_VERSION`; elsewhere it skips that check. Both Actions interfaces run it in every release after context capture, and the reusable workflow runs only it for [dry runs](actions/release.md#dry-run). `release:workflow:credentials` directly invokes [`Workflow::RubyGemsCredentials`](workflow/ruby_gems_credentials.md) with optional `RUBYGEMS_OWNER_ID`. It remains available for custom RubyGems commands, but neither Actions interface calls a separate authentication task. Normal authentication belongs to `release:publish` through the configured destination. diff --git a/lib/ruby-gem-release/workflow/github_permissions.rb b/lib/ruby-gem-release/workflow/github_permissions.rb new file mode 100644 index 0000000..81a8722 --- /dev/null +++ b/lib/ruby-gem-release/workflow/github_permissions.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +require_relative '../github_api' +require_relative '../source_control/git' + +module RubyGemRelease + module Workflow + # Checks that the job's GitHub token can push release commits and tags, + # without sending any objects or changing refs. + class GitHubPermissions + BRANCH_BLOCKERS = %w[pull_request required_status_checks required_signatures update required_deployments merge_queue].freeze + TAG_BLOCKERS = %w[creation required_signatures].freeze + BYPASS = %w[always exempt].freeze + + def initialize(branch:, tag: nil, api: GitHubAPI.new, remote: 'origin') + raise ArgumentError, 'a default branch is required to check GitHub permissions' if branch.to_s.empty? + + @branch = branch + @tag = tag + @api = api + @remote = remote + end + + def check! + check_push! + failures = blocked_branch_rules + blocked_tag_rules + raise "GitHub rules would reject the release push: #{failures.join('; ')}" unless failures.empty? + + ["Verified GitHub push access to #{@branch}#{" and tag #{@tag}" if @tag}", *warnings] + end + + private + + def check_push! + SourceControl::Git.command('push', '--dry-run', '--porcelain', @remote, "HEAD:refs/heads/#{@branch}") + rescue RuntimeError => e + raise "GitHub token cannot push to #{@branch}; grant contents: write. #{e.message}" + end + + def blocked_branch_rules + rules = Array(@api.get("rules/branches/#{@branch}")).select { |rule| BRANCH_BLOCKERS.include?(rule['type']) } + rules.group_by { |rule| rule['ruleset_id'] }.filter_map do |id, matched| + ruleset = ruleset(id) + blocked(ruleset, id, "branch #{@branch}", matched.map { |rule| rule['type'] }.uniq) unless bypass?(ruleset) + end + end + + def blocked_tag_rules + return [] unless @tag + + Array(@api.get('rulesets?includes_parents=true&targets=tag')).filter_map do |summary| + ruleset = ruleset(summary['id']) + types = tag_blockers(ruleset) + blocked(ruleset, summary['id'], "tag #{@tag}", types) unless types.empty? || bypass?(ruleset) + end + end + + def tag_blockers(ruleset) + return [] unless ruleset && ruleset['enforcement'] == 'active' && matches?(ruleset, "refs/tags/#{@tag}") + + Array(ruleset['rules']).map { |rule| rule['type'] } & TAG_BLOCKERS + end + + def ruleset(id) + @api.get("rulesets/#{id}?includes_parents=true") + end + + def bypass?(ruleset) + ruleset && BYPASS.include?(ruleset['current_user_can_bypass']) + end + + def matches?(ruleset, ref) + names = ruleset.dig('conditions', 'ref_name') || {} + included = Array(names['include']).any? { |pattern| pattern == '~ALL' || File.fnmatch?(pattern, ref) } + included && Array(names['exclude']).none? { |pattern| File.fnmatch?(pattern, ref) } + end + + def blocked(ruleset, id, ref, types) + name = ruleset && ruleset['name'] + "#{ref}: #{name ? "ruleset #{name.inspect}" : "ruleset #{id}"} requires #{types.join(', ')}" + end + + def warnings + branch = @api.get("branches/#{@branch}") + return [] unless branch.is_a?(Hash) && branch['protected'] + + ["Warning: #{@branch} has branch protection; its push restrictions are not readable without admin access, so confirm the release token may push to it"] + end + end + end +end diff --git a/lib/ruby-gem-release/workflow/preflight.rb b/lib/ruby-gem-release/workflow/preflight.rb index 3678f1b..d495d02 100644 --- a/lib/ruby-gem-release/workflow/preflight.rb +++ b/lib/ruby-gem-release/workflow/preflight.rb @@ -1,24 +1,40 @@ # frozen_string_literal: true require_relative '../execution_provider' +require_relative '../execution_provider/github' require_relative 'ruby_gems_credentials' +require_relative 'github_permissions' module RubyGemRelease module Workflow # Checks release prerequisites without editing files, pushing, or publishing. class Preflight - def initialize(destination:, provider: ExecutionProvider.current, output: $stdout) + def initialize(destination:, provider: ExecutionProvider.current, output: $stdout, github: nil) @destination = destination @provider = provider @output = output + @github = github end def check! @output.puts(trusted_publishing) + @output.puts(github_permissions) end private + def github_permissions + return 'Skipped GitHub permissions: not running on GitHub Actions' unless @github || @provider.is_a?(ExecutionProvider::GitHub) + + (@github || GitHubPermissions.new(branch: @provider.fetch('DEFAULT_BRANCH', ''), tag: release_tag, + api: GitHubAPI.new(repository: @provider.fetch('GITHUB_REPOSITORY', nil)))).check! + end + + def release_tag + version = [@provider.fetch('INPUT_VERSION', ''), @provider.fetch('GEMSPEC_VERSION', '')].find { |value| !value.empty? } + "v#{version}" if version + end + def trusted_publishing return 'Skipped RubyGems Trusted Publishing: the destination does not use RubyGems authentication' unless @destination.authentication == 'rubygems' diff --git a/spec/fixtures/github_release_examples.rb b/spec/fixtures/github_release_examples.rb index 66d6cf0..89e73e9 100644 --- a/spec/fixtures/github_release_examples.rb +++ b/spec/fixtures/github_release_examples.rb @@ -128,7 +128,7 @@ def capture3(*command) endpoint = command.last raise 'Unexpected artifact discovery' if endpoint.include?('/actions/') path = File.join(service, 'hosting.json') - data = File.file?(path) ? JSON.parse(File.read(path)) : nil + data = File.file?(path) && endpoint.include?('/releases/') ? JSON.parse(File.read(path)) : nil code = data ? '200 OK' : '404 Not Found' return ["HTTP/2.0 " + code + "\\n\\n" + JSON.generate(data), '', Struct.new(:success?).new(true)] end diff --git a/spec/ruby_gem_release/workflow/git_hub_permissions_spec.rb b/spec/ruby_gem_release/workflow/git_hub_permissions_spec.rb new file mode 100644 index 0000000..5f7322f --- /dev/null +++ b/spec/ruby_gem_release/workflow/git_hub_permissions_spec.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require 'spec_helper' +require 'ruby-gem-release/workflow/github_permissions' + +RSpec.describe RubyGemRelease::Workflow::GitHubPermissions do + let(:responses) { {} } + let(:api) { instance_double(RubyGemRelease::GitHubAPI) } + let(:permissions) { described_class.new(branch: 'main', tag: 'v1.2.3', api: api) } + + before do + allow(api).to receive(:get) { |path| responses[path] } + allow(RubyGemRelease::SourceControl::Git).to receive(:command).and_return('') + end + + def ruleset(id, bypass: 'never', **attributes) + responses["rulesets/#{id}?includes_parents=true"] = { 'id' => id, 'name' => "Rules #{id}", 'current_user_can_bypass' => bypass, **attributes.transform_keys(&:to_s) } + end + + it 'verifies push access without sending objects when no rules block the release' do + expect(permissions.check!).to eq(['Verified GitHub push access to main and tag v1.2.3']) + expect(RubyGemRelease::SourceControl::Git).to have_received(:command).with('push', '--dry-run', '--porcelain', 'origin', 'HEAD:refs/heads/main') + end + + it 'explains a token without write access' do + allow(RubyGemRelease::SourceControl::Git).to receive(:command).and_raise(RuntimeError, 'Git command failed: Permission denied (403)') + expect { permissions.check! }.to raise_error(/cannot push to main; grant contents: write. Git command failed: Permission denied/) + end + + it 'rejects branch rules the token cannot bypass and ignores rules it can bypass or that allow the push', :aggregate_failures do + responses['rules/branches/main'] = [ + { 'type' => 'pull_request', 'ruleset_id' => 1 }, { 'type' => 'required_signatures', 'ruleset_id' => 1 }, + { 'type' => 'required_status_checks', 'ruleset_id' => 2 }, { 'type' => 'deletion', 'ruleset_id' => 3 }, + { 'type' => 'update', 'ruleset_id' => 4 } + ] + ruleset(1) + ruleset(2, bypass: 'always') + expect { permissions.check! }.to raise_error( + 'GitHub rules would reject the release push: branch main: ruleset "Rules 1" requires pull_request, required_signatures; ' \ + 'branch main: ruleset 4 requires update' + ) + end + + it 'rejects active tag rulesets matching the release tag unless bypassed or excluded', :aggregate_failures do + responses['rulesets?includes_parents=true&targets=tag'] = [1, 2, 3, 4, 5].map { |id| { 'id' => id } } + matching = { 'conditions' => { 'ref_name' => { 'include' => ['refs/tags/v*'], 'exclude' => [] } }, 'enforcement' => 'active', 'rules' => [{ 'type' => 'creation' }] } + ruleset(1, **matching) + ruleset(2, **matching, bypass: 'exempt') + ruleset(3, **matching, enforcement: 'evaluate') + ruleset(4, **matching, conditions: { 'ref_name' => { 'include' => ['~ALL'], 'exclude' => ['refs/tags/v1.*'] } }) + ruleset(5, **matching, rules: [{ 'type' => 'deletion' }]) + expect { permissions.check! }.to raise_error('GitHub rules would reject the release push: tag v1.2.3: ruleset "Rules 1" requires creation') + end + + it 'skips tag rules when the release tag is unknown' do + expect(described_class.new(branch: 'main', api: api).check!).to eq(['Verified GitHub push access to main']) + expect(api).not_to have_received(:get).with('rulesets?includes_parents=true&targets=tag') + end + + it 'warns about branch protection it cannot inspect' do + responses['branches/main'] = { 'name' => 'main', 'protected' => true } + expect(permissions.check!.last).to start_with('Warning: main has branch protection') + end + + it 'requires a default branch' do + expect { described_class.new(branch: '', api: api) }.to raise_error(ArgumentError, /default branch/) + end +end diff --git a/spec/ruby_gem_release/workflow/preflight_spec.rb b/spec/ruby_gem_release/workflow/preflight_spec.rb index 7fd466a..1123e45 100644 --- a/spec/ruby_gem_release/workflow/preflight_spec.rb +++ b/spec/ruby_gem_release/workflow/preflight_spec.rb @@ -14,13 +14,15 @@ allow(RubyGemRelease::Workflow::RubyGemsCredentials).to receive(:new).with(owner: '123', provider: provider).and_return(credentials) allow(credentials).to receive(:check!).and_return('repository' => 'owner/example', 'environment' => 'release', 'scopes' => ['push_rubygem']) described_class.new(destination: RubyGemRelease::Destination::RubyGems.new, provider: provider, output: output).check! - expect(output.string).to eq("Verified RubyGems Trusted Publishing: repository owner/example; environment release; scopes push_rubygem\n") + expect(output.string).to eq("Verified RubyGems Trusted Publishing: repository owner/example; environment release; scopes push_rubygem\n" \ + "Skipped GitHub permissions: not running on GitHub Actions\n") end it 'skips the check for destinations without RubyGems authentication' do allow(RubyGemRelease::Workflow::RubyGemsCredentials).to receive(:new) described_class.new(destination: RubyGemRelease::Destination.new, provider: provider, output: output).check! - expect(output.string).to eq("Skipped RubyGems Trusted Publishing: the destination does not use RubyGems authentication\n") + expect(output.string).to eq("Skipped RubyGems Trusted Publishing: the destination does not use RubyGems authentication\n" \ + "Skipped GitHub permissions: not running on GitHub Actions\n") expect(RubyGemRelease::Workflow::RubyGemsCredentials).not_to have_received(:new) end @@ -31,4 +33,27 @@ .to raise_error(/HTTP 404/) expect(output.string).to eq('') end + + context 'with GitHub Actions' do + let(:environment) { { 'GITHUB_ACTIONS' => 'true', 'DEFAULT_BRANCH' => 'main', 'GITHUB_REPOSITORY' => 'owner/example', 'GEMSPEC_VERSION' => '1.2.3', 'INPUT_VERSION' => '' } } + let(:provider) { RubyGemRelease::ExecutionProvider::GitHub.new(environment: environment) } + let(:permissions) { instance_double(RubyGemRelease::Workflow::GitHubPermissions, check!: ['Verified GitHub push access to main and tag v1.2.3']) } + + before { allow(RubyGemRelease::Workflow::GitHubPermissions).to receive(:new).and_return(permissions) } + + it 'checks the default branch and the captured release tag' do + described_class.new(destination: RubyGemRelease::Destination.new, provider: provider, output: output).check! + expect(RubyGemRelease::Workflow::GitHubPermissions).to have_received(:new).with(branch: 'main', tag: 'v1.2.3', api: an_instance_of(RubyGemRelease::GitHubAPI)) + expect(output.string.lines.last).to eq("Verified GitHub push access to main and tag v1.2.3\n") + end + + it 'checks the selected release version tag and omits the tag when no version is known' do + environment['INPUT_VERSION'] = '2.0.0' + described_class.new(destination: RubyGemRelease::Destination.new, provider: provider, output: output).check! + environment.merge!('INPUT_VERSION' => '', 'GEMSPEC_VERSION' => '') + described_class.new(destination: RubyGemRelease::Destination.new, provider: provider, output: output).check! + expect(RubyGemRelease::Workflow::GitHubPermissions).to have_received(:new).with(hash_including(tag: 'v2.0.0')).ordered + expect(RubyGemRelease::Workflow::GitHubPermissions).to have_received(:new).with(hash_including(tag: nil)).ordered + end + end end diff --git a/spec/workflow_interfaces_spec.rb b/spec/workflow_interfaces_spec.rb index b46db9f..2cb94ce 100644 --- a/spec/workflow_interfaces_spec.rb +++ b/spec/workflow_interfaces_spec.rb @@ -25,6 +25,7 @@ preflight = steps.find { |step| step['id'] == 'check_release_prerequisites' } expect(preflight.fetch('run')).to eq('bundle exec rake release:workflow:preflight') expect(preflight.dig('env', 'RELEASE_STEP_ID')).to eq('check_release_prerequisites') + expect(preflight.dig('env', 'GH_TOKEN')).to eq('${{ github.token }}') expect(preflight.fetch('if', '${{ success() }}')).to eq('${{ success() }}') expect(steps.index(preflight)).to be > steps.index { |step| step['id'] == 'capture_release_context' } expect(steps.index(preflight)).to be < steps.index { |step| step['id'] == 'validate_release' } @@ -135,8 +136,9 @@ def run_step(id, directory:, command: '') preflight = workflow.dig('jobs', 'preflight') expect(preflight).to include('if' => '${{ inputs.dry-run }}', 'environment' => 'release') expect(preflight.dig('env', 'RUBYGEMS_OWNER_ID')).to eq('${{ inputs.rubygems-owner }}') - expect(preflight.fetch('steps').map { |step| step['run'] }.compact).to eq(['bundle exec rake release:workflow:preflight']) - expect(preflight.fetch('steps').first.dig('with', 'persist-credentials')).to be(false) + expect(preflight.fetch('steps').map { |step| step['run'] }.compact).to eq(['bundle exec rake release:workflow:capture', 'bundle exec rake release:workflow:preflight']) + expect(preflight.fetch('env')).to eq(workflow.dig('jobs', 'release', 'env')) + expect(preflight.fetch('steps').last).to eq(steps.find { |step| step['id'] == 'check_release_prerequisites' }) end it 'lets this repository dispatch a dry run of its own release' do