Add the project's canonical SPDX license header to a requested source file or to source files under a requested directory. Use when asked to add or ensure license headers on files that may not already have one.
Add the project's canonical SPDX license header to a requested source file or to source files under a requested directory. Use when asked to add or ensure license headers on files that may not already have one.
Add License Header
Determine the target files from the request:
For a file path, target that file.
For a directory, target every file beneath it whose extension matches the project's source extensions.
Read the first 20 lines of every target file and look for SPDX-License-Identifier.
If that string is present, skip the file. Never add a second SPDX license header.
Otherwise, insert these exact lines at the very top of the file, before all existing content: