This is an automated email from the ASF dual-hosted git repository.
turaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 49c3d0c9ee9 Add prek hook to check NOTICE files for content (#60699)
49c3d0c9ee9 is described below
commit 49c3d0c9ee995e6654079c8a9a49e3ca9cc380eb
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Jan 17 16:20:55 2026 +0100
Add prek hook to check NOTICE files for content (#60699)
Related: #60540
Co-authored-by: Jason(Zhe-You) Liu
<[email protected]>
---
.pre-commit-config.yaml | 5 +++
.../prek/check_contextmanager_class_decorators.py | 0
scripts/ci/prek/check_notice_files.py | 50 ++++++++++++++++++++++
3 files changed, 55 insertions(+)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5f1d5eeaf9f..18b04e9fa20 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -183,6 +183,11 @@ repos:
entry: ./scripts/ci/prek/check_min_python_version.py
language: python
require_serial: true
+ - id: check-notice-files
+ name: Check NOTICE files for current year and ASF references
+ entry: ./scripts/ci/prek/check_notice_files.py
+ language: python
+ files: ^.*NOTICE$
- id: check-version-consistency
name: Check version consistency
entry: ./scripts/ci/prek/check_version_consistency.py
diff --git a/scripts/ci/prek/check_contextmanager_class_decorators.py
b/scripts/ci/prek/check_contextmanager_class_decorators.py
old mode 100644
new mode 100755
diff --git a/scripts/ci/prek/check_notice_files.py
b/scripts/ci/prek/check_notice_files.py
new file mode 100755
index 00000000000..93b5d0fdc4c
--- /dev/null
+++ b/scripts/ci/prek/check_notice_files.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+# /// script
+# requires-python = ">=3.10, <3.11"
+# dependencies = []
+# ///
+"""
+Check that NOTICE files contain the current year and Apache Software
Foundation reference.
+
+This script validates NOTICE files to ensure they:
+- Include the current year in copyright statements
+- Reference the Apache Software Foundation
+
+Usage: check_notice_files.py <notice_file_paths...>
+"""
+
+from __future__ import annotations
+
+import sys
+from datetime import datetime
+from pathlib import Path
+
+CURRENT_YEAR = str(datetime.now().year)
+
+errors = 0
+
+for notice_file in sys.argv[1:]:
+ content = Path(notice_file).read_text()
+
+ expected = f"Copyright 2016-{CURRENT_YEAR} The Apache Software Foundation"
+ if "Copyright" in content and expected not in content:
+ print(f"❌ {notice_file}: Missing expected string: {expected!r}")
+ errors += 1
+
+sys.exit(1 if errors else 0)