Skip to content
Merged
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
15 changes: 11 additions & 4 deletions .github/workflows/check_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,24 @@ 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"
ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" refs/heads/master
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
if: ${{ github.repository == 'ruby/ruby' && github.ref == 'refs/heads/master' && 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
Expand Down
2 changes: 1 addition & 1 deletion libexec/erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tool/auto-style.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down