From 89b67d09ba2de2f30cbfab325e1bfa7a03872024 Mon Sep 17 00:00:00 2001 From: YanxuanLiu Date: Mon, 11 Nov 2024 22:11:31 +0800 Subject: [PATCH] add license header check for test Signed-off-by: YanxuanLiu --- .github/workflows/license-header-check.yml | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/license-header-check.yml diff --git a/.github/workflows/license-header-check.yml b/.github/workflows/license-header-check.yml new file mode 100644 index 00000000000..720eb642fb9 --- /dev/null +++ b/.github/workflows/license-header-check.yml @@ -0,0 +1,44 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A workflow to check if PR got sign-off +name: license header check + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +jobs: + license-header-check: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get changed files + id: getChangedFiles + run: | + base_sha=${{ github.event.pull_request.base.sha }} + head_sha=${{ github.event.pull_request.head.sha }} + changed_files=$(git diff $base_sha $head_sha) + IFS=$'\n' read -d '' -r -a changed_files_array <<< "$changed_files" + + - name: license-header-check + uses: YanxuanLiu/spark-rapids-common/license-header-check@license-header-check + with: + files: $changed_files_array + excludes: | + *.md + LICENSE + \ No newline at end of file