From 0c065fa4cf5dc6e4738b887f00d62650c38066ff Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Tue, 9 Sep 2025 14:00:28 +0200 Subject: [PATCH] Sort out windows CRLF mess --- .github/workflows/pr-checks.yml | 4 ++++ pr-checks/sync.py | 6 +++--- pr-checks/sync.sh | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index d33825251..d4993b6ce 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -26,6 +26,10 @@ jobs: timeout-minutes: 45 steps: + - name: Prepare git (Windows) + if: runner.os == 'Windows' + run: git config --global core.autocrlf false + - uses: actions/checkout@v5 - name: Set up Node.js diff --git a/pr-checks/sync.py b/pr-checks/sync.py index 7d360083f..8a03822d9 100755 --- a/pr-checks/sync.py +++ b/pr-checks/sync.py @@ -240,7 +240,7 @@ for file in sorted((this_dir / 'checks').glob('*.yml')): }) raw_file = this_dir.parent / ".github" / "workflows" / f"__{checkName}.yml.raw" - with open(raw_file, 'w') as output_stream: + with open(raw_file, 'w', newline='\n') as output_stream: writeHeader(output_stream) yaml.dump({ 'name': f"PR Check - {checkSpecification['name']}", @@ -274,7 +274,7 @@ for file in sorted((this_dir / 'checks').glob('*.yml')): }, output_stream) with open(raw_file, 'r') as input_stream: - with open(this_dir.parent / ".github" / "workflows" / f"__{checkName}.yml", 'w') as output_stream: + with open(this_dir.parent / ".github" / "workflows" / f"__{checkName}.yml", 'w', newline='\n') as output_stream: content = input_stream.read() output_stream.write("\n".join(list(map(lambda x:x.rstrip(), content.splitlines()))+[''])) os.remove(raw_file) @@ -328,7 +328,7 @@ for collection_name in collections: }, output_stream) with open(raw_file, 'r') as input_stream: - with open(this_dir.parent / ".github" / "workflows" / f"__{collection_name}.yml", 'w') as output_stream: + with open(this_dir.parent / ".github" / "workflows" / f"__{collection_name}.yml", 'w', newline='\n') as output_stream: content = input_stream.read() output_stream.write("\n".join(list(map(lambda x:x.rstrip(), content.splitlines()))+[''])) os.remove(raw_file) diff --git a/pr-checks/sync.sh b/pr-checks/sync.sh index 016e50939..85df3272c 100755 --- a/pr-checks/sync.sh +++ b/pr-checks/sync.sh @@ -3,7 +3,7 @@ set -e cd "$(dirname "$0")" python3 -m venv env -source env/bin/activate +source env/*/activate pip3 install ruamel.yaml==0.17.31 python3 sync.py