Skip to content

Commit 3d3e046

Browse files
committed
CI: Check if sources are valid as UTF-8
1 parent d3c80c0 commit 3d3e046

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/check_misc.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,18 @@ jobs:
3838
# Skip 'push' events because post_push.yml fixes them on push
3939
if: ${{ github.repository == 'ruby/ruby' && startsWith(github.event_name, 'pull') }}
4040

41-
# - name: Check if C-sources are UTF-8
42-
# run: |
43-
# grep -r -n --exclude-dir=vendor --include='*.[chyS]' --include='*.asm' $'[^\t-~]' -- . && exit 1 || :
41+
- name: Check if C-sources are UTF-8
42+
run: |
43+
#!ruby
44+
ok = true
45+
Dir.glob("*.{[chyS],asm}") do |f|
46+
unless File.binread(f).force_encoding(Encoding::UTF_8).valid_encoding?
47+
ok = false
48+
puts f
49+
end
50+
end
51+
exit ok
52+
shell: ruby {0}
4453

4554
- name: Check for bash specific substitution in configure.ac
4655
run: |

0 commit comments

Comments
 (0)