Run auto-style.rb only on ruby/ruby

`github.event.before` for newly pushed branch is all zero and cannot
check out.
This commit is contained in:
Nobuyoshi Nakada 2025-04-23 18:42:46 +09:00
parent 1048b162de
commit 7d7478c7bc
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-04-23 10:42:49 +00:00

View File

@ -29,7 +29,7 @@ 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.repository == 'ruby/ruby' && github.ref == 'refs/heads/master') && 'Auto-correct' || 'Check for' }} code styles
- name: ${{ github.ref == 'refs/heads/master' && 'Auto-correct' || 'Check for' }} code styles
run: |
set -x
ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" "$PUSH_REF"
@ -39,7 +39,8 @@ jobs:
GIT_COMMITTER_NAME: git
GITHUB_OLD_SHA: ${{ startsWith(github.event_name, 'pull') && github.event.pull_request.base.sha || github.event.before }}
GITHUB_NEW_SHA: ${{ startsWith(github.event_name, 'pull') && github.event.pull_request.merge_commit_sha || github.event.after }}
PUSH_REF: ${{ (github.repository == 'ruby/ruby' && github.ref == 'refs/heads/master') && github.ref || '' }}
PUSH_REF: ${{ github.ref == 'refs/heads/master' && github.ref || '' }}
if: ${{ github.repository == 'ruby/ruby' }}
- name: Check if C-sources are US-ASCII
run: |