File tree Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Check that source code files in this repo have the appropriate license
4
+ # header.
5
+
6
+ if [ " $TRACE " != " " ]; then
7
+ export PS4=' ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
8
+ set -o xtrace
9
+ fi
10
+ set -o errexit
11
+ set -o pipefail
12
+
13
+ TOP=$( cd " $( dirname " $0 " ) /.." > /dev/null && pwd)
14
+
15
+ NLINES1=$(( $(wc - l .github/ license- header.txt | awk '{print $1 }')+ 1 ))
16
+ NLINES2=$(( NLINES1 + 1 ))
17
+
18
+ function check_license_header {
19
+ local f
20
+ f=$1
21
+
22
+ if ! diff -w .github/license-header.txt <( head -$NLINES2 " $f " | tail -$NLINES1 ) > /dev/null; then
23
+ echo " check-license-headers: error: '$f ' does not have required license header, see 'diff -w .github/license-header.txt <(head -$NLINES2 $f | tail -$NLINES1 )'"
24
+ return 1
25
+ else
26
+ return 0
27
+ fi
28
+ }
29
+
30
+
31
+ cd " $TOP "
32
+ nErrors=0
33
+ for f in $( git ls-files | grep ' \.php$' ) ; do
34
+ if ! check_license_header $f ; then
35
+ nErrors=$(( nErrors+ 1 ))
36
+ fi
37
+ done
38
+
39
+ if [[ $nErrors -eq 0 ]]; then
40
+ exit 0
41
+ else
42
+ exit 1
43
+ fi
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Elasticsearch PHP client
3
+ *
4
+ * @link https://github.com/elastic/elasticsearch-php/
5
+ * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
6
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
7
+ * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
8
+ *
9
+ * Licensed to Elasticsearch B.V under one or more agreements.
10
+ * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
11
+ * the GNU Lesser General Public License, Version 2.1, at your option.
12
+ * See the LICENSE file in the project root for more information.
13
+ */
Original file line number Diff line number Diff line change
1
+ name : License headers
2
+
3
+ on : [pull_request]
4
+
5
+ jobs :
6
+ build :
7
+
8
+ runs-on : ubuntu-latest
9
+
10
+ steps :
11
+ - uses : actions/checkout@v2
12
+
13
+ - name : Check license headers
14
+ run : |
15
+ ./.github/check-license-headers.sh
You can’t perform that action at this time.
0 commit comments