diff --git a/.github/add-license-headers.sh b/.github/add-license-headers.sh index 142a251529f..5eccd4cd03d 100644 --- a/.github/add-license-headers.sh +++ b/.github/add-license-headers.sh @@ -5,10 +5,11 @@ function add_license () { (find "$script_path" -name $1 | grep -v "/bin/" | grep -v "/obj/" )|while read fname; do line=$(sed -n '2p;3q' "$fname") if ! [[ "$line" == " * Licensed to Elasticsearch B.V. under one or more contributor" ]] ; then - cat "${script_path}.github/license-header.txt" "$fname" > "${fname}.new" + # awk joins the header with the existing file, inserting a newline between them + awk '(NR>1 && FNR==1){print ""}1' "${script_path}.github/license-header.txt" "$fname" > "${fname}.new" mv "${fname}.new" "$fname" fi done } -add_license "*.cs" +add_license "*.cs" \ No newline at end of file diff --git a/.github/license-header.txt b/.github/license-header.txt index ce99d4cac30..9880b336e76 100644 --- a/.github/license-header.txt +++ b/.github/license-header.txt @@ -16,4 +16,3 @@ * specific language governing permissions and limitations * under the License. */ -