From cd42001f7d7bae833673bc08375af97395d66348 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 27 Sep 2025 19:57:56 -0700 Subject: [PATCH 1/5] [ruby/erb] Remove a trailing space https://github.com/ruby/erb/commit/51c0922170 --- libexec/erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/erb b/libexec/erb index a1fb7457585d9b..de7d5888c346e8 100755 --- a/libexec/erb +++ b/libexec/erb @@ -132,7 +132,7 @@ Filepaths: If no filepaths are given, the sole input is the standard input. -See details and examples at https://docs.ruby-lang.org/en/master/erb_executable_md.html +See details and examples at https://docs.ruby-lang.org/en/master/erb_executable_md.html EOU exit 1 end From 9b5eb828025cf0b7c023325e6e086422bcada355 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 27 Sep 2025 20:08:07 -0700 Subject: [PATCH 2/5] Resurrect support of auto-style on master which was broken by 9255db4bc08766763a6d78f50a90e05c58980899 --- .github/workflows/check_misc.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_misc.yml b/.github/workflows/check_misc.yml index d4a2c6f3fef6eb..5cca11abceaa20 100644 --- a/.github/workflows/check_misc.yml +++ b/.github/workflows/check_misc.yml @@ -29,17 +29,25 @@ jobs: checkout: '' # false (ref: https://github.com/actions/runner/issues/2238) # Run this step first to make sure auto-style commits are pushed - - name: ${{ github.ref == 'refs/heads/master' && 'Auto-correct' || 'Check for' }} code styles + - name: Auto-correct code styles run: | set -x ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" "$PUSH_REF" env: - EMAIL: svn-admin@ruby-lang.org + GITHUB_OLD_SHA: ${{ github.event.before }} + GITHUB_NEW_SHA: ${{ github.event.after }} GIT_AUTHOR_NAME: git GIT_COMMITTER_NAME: git + EMAIL: svn-admin@ruby-lang.org + PUSH_REF: ${{ github.ref }} + if: ${{ github.repository == 'ruby/ruby' && github.event_name == 'push' }} + - name: Check for code styles + run: | + set -x + ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" + env: GITHUB_OLD_SHA: ${{ github.event.pull_request.base.sha }} GITHUB_NEW_SHA: ${{ github.event.pull_request.merge_commit_sha }} - PUSH_REF: ${{ github.ref == 'refs/heads/master' && github.ref || '' }} if: ${{ github.repository == 'ruby/ruby' && startsWith(github.event_name, 'pull') }} - name: Check if C-sources are US-ASCII From 4a1d078636776d8c6544ee18d05730c2ea31ef99 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 27 Sep 2025 20:10:19 -0700 Subject: [PATCH 3/5] Limit the auto-style push to master It probably doesn't need to run for topic branches created by dependabot, and it's also likely annoying in stable branches like ruby_X_Y too. --- .github/workflows/check_misc.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_misc.yml b/.github/workflows/check_misc.yml index 5cca11abceaa20..7c745acf568202 100644 --- a/.github/workflows/check_misc.yml +++ b/.github/workflows/check_misc.yml @@ -32,15 +32,14 @@ jobs: - name: Auto-correct code styles run: | set -x - ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" "$PUSH_REF" + ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" refs/heads/master env: GITHUB_OLD_SHA: ${{ github.event.before }} GITHUB_NEW_SHA: ${{ github.event.after }} GIT_AUTHOR_NAME: git GIT_COMMITTER_NAME: git EMAIL: svn-admin@ruby-lang.org - PUSH_REF: ${{ github.ref }} - if: ${{ github.repository == 'ruby/ruby' && github.event_name == 'push' }} + if: ${{ github.repository == 'ruby/ruby' && github.ref == 'refs/heads/master' && github.event_name == 'push' }} - name: Check for code styles run: | set -x From 8300c52f565e5a106037bb7ec25eec78c15995a8 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 27 Sep 2025 20:15:45 -0700 Subject: [PATCH 4/5] Reuse a cmd array created for printing Fixes 21c7131df818c1f7f571d4ccf9be150d2c9cc374 differently. This makes it less likely that the printed command is deviated from what's actually executed. --- tool/auto-style.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tool/auto-style.rb b/tool/auto-style.rb index 259ed377bc7036..0d6fe0255af859 100755 --- a/tool/auto-style.rb +++ b/tool/auto-style.rb @@ -71,9 +71,9 @@ def diff private def git(*args, **opts) - cmd = ['git', *args].shelljoin - puts "+ #{cmd}" - ret = with_clean_env { system('git', *args, **opts) } + cmd = ['git', *args] + puts "+ #{cmd.shelljoin}" + ret = with_clean_env { system(*cmd, **opts) } unless ret or opts[:err] abort "Failed to run: #{cmd}" end From a8184e35b55221621451ca9002550d32b0f49119 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 27 Sep 2025 22:46:33 -0700 Subject: [PATCH 5/5] Fix a check on pushref Empty pushref is no longer given 9b5eb828025cf0b7c023325e6e086422bcada355 --- tool/auto-style.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/auto-style.rb b/tool/auto-style.rb index 0d6fe0255af859..3b93c8c3179291 100755 --- a/tool/auto-style.rb +++ b/tool/auto-style.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # Usage: -# auto-style.rb [oldrev] [newrev] [pushref] +# auto-style.rb oldrev newrev [pushref] require 'shellwords' require 'tmpdir' @@ -251,7 +251,7 @@ def adjust_styles(files) _, *updated_files = ARGV git = Git.new(nil, nil) else - unless dry_run = pushref.empty? + unless dry_run = pushref.nil? branch = IO.popen(['git', 'rev-parse', '--symbolic', '--abbrev-ref', pushref], &:read).strip end git = Git.new(oldrev, newrev, branch)