From 0ae563857f9d8582acc56cd9b8b022a9549e5da7 Mon Sep 17 00:00:00 2001 From: Ads Dawson <104169244+GangGreenTemperTatum@users.noreply.github.com> Date: Thu, 26 Dec 2024 19:47:54 -0500 Subject: [PATCH] chore: add workflow validation to fix windows colon errors (#520) * chore: add workflow validation to fix windows colon errors * chore: also add commits * fix: use checkout * chore: tested and worked fixing file --- .github/workflows/check-filenames-pr.yml | 35 +++++++++++++++++++ ...{ISO20547-4:2020.md => ISO20547-4_2020.md} | 0 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/check-filenames-pr.yml rename data_gathering/mappings/{ISO20547-4:2020.md => ISO20547-4_2020.md} (100%) diff --git a/.github/workflows/check-filenames-pr.yml b/.github/workflows/check-filenames-pr.yml new file mode 100644 index 00000000..f40b5a08 --- /dev/null +++ b/.github/workflows/check-filenames-pr.yml @@ -0,0 +1,35 @@ +name: Check Filenames on PR and Commits + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - '**' + +jobs: + check-filenames: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 + with: + fetch-depth: 0 + + - name: Check for invalid filenames + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + invalid_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep ":" || true) + else + invalid_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep ":" || true) + if [ -z "$invalid_files" ]; then + # Also check all files in the current commit + invalid_files=$(git ls-files | grep ":" || true) + fi + fi + + if [ ! -z "$invalid_files" ]; then + echo "Error: The following files contain ':' in their names, which is not compatible with Windows:" + echo "$invalid_files" + exit 1 + fi \ No newline at end of file diff --git a/data_gathering/mappings/ISO20547-4:2020.md b/data_gathering/mappings/ISO20547-4_2020.md similarity index 100% rename from data_gathering/mappings/ISO20547-4:2020.md rename to data_gathering/mappings/ISO20547-4_2020.md