Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/actions/verify-boilerplate/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright The Kubeflow Authors.
#
# 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.

name: Verify Boilerplate Headers
description: >
Verify that every source file carries the required Apache 2.0 copyright
header. Wraps hack/boilerplate/boilerplate.py from kubeflow/testing so
callers never need to vendor the script.
Comment thread
Prachi01Yadav marked this conversation as resolved.
Outdated

inputs:
base-ref:
description: >
Base branch for new-file detection. Defaults to the pull-request base
branch (github.base_ref) so only changed/new files are flagged for
year-less header enforcement.
Comment thread
Prachi01Yadav marked this conversation as resolved.
Outdated
required: false
default: ""
boilerplate-dir:
description: >
Directory containing boilerplate template files (boilerplate.*.txt).
Leave empty to use the templates shipped with kubeflow/testing.
required: false
default: ""
Comment thread
Prachi01Yadav marked this conversation as resolved.
Outdated
python-version:
description: Python version to use.
Comment thread
Prachi01Yadav marked this conversation as resolved.
Outdated
required: false
default: "3.12"

runs:
using: composite
steps:
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
Comment thread
Prachi01Yadav marked this conversation as resolved.
with:
python-version: ${{ inputs.python-version }}
Comment thread
Prachi01Yadav marked this conversation as resolved.

- name: Checkout kubeflow/testing
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Comment thread
Prachi01Yadav marked this conversation as resolved.
Outdated
with:
repository: kubeflow/testing
path: .kubeflow-testing
sparse-checkout: hack/boilerplate

- name: Run boilerplate check
shell: bash
env:
BASE_REF: ${{ inputs.base-ref || github.base_ref || 'master' }}
BOILERPLATE_DIR: ${{ inputs.boilerplate-dir }}
run: |
ARGS=("--base-ref" "${BASE_REF}")

if [[ -n "${BOILERPLATE_DIR}" ]]; then
ARGS+=("--boilerplate-dir" "${BOILERPLATE_DIR}")
else
ARGS+=("--boilerplate-dir" ".kubeflow-testing/hack/boilerplate")
fi

python .kubeflow-testing/hack/boilerplate/boilerplate.py "${ARGS[@]}"
Comment thread
Prachi01Yadav marked this conversation as resolved.
Outdated

- name: Cleanup
if: always()
shell: bash
run: rm -rf .kubeflow-testing
Comment thread
Prachi01Yadav marked this conversation as resolved.
Outdated