File tree Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Expand file tree Collapse file tree 3 files changed +66
-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+ LICENSE=$( cat .github/license-header.txt)
15+
16+ function check_license_header {
17+ local f
18+ f=$1
19+ if ! grep -Fxq " $LICENSE " " $f " ; then
20+ echo " check-license-headers: error: '$f ' does not have required license header"
21+ return 1
22+ else
23+ return 0
24+ fi
25+ }
26+
27+
28+ cd " $TOP "
29+ nErrors=0
30+ for f in $( git ls-files | grep -E ' \.rb|Rakefile|\.rake|\.erb|Gemfile' ) ; do
31+ if ! check_license_header $f ; then
32+ nErrors=$(( nErrors+ 1 ))
33+ fi
34+ done
35+
36+ if [[ $nErrors -eq 0 ]]; then
37+ exit 0
38+ else
39+ exit 1
40+ fi
Original file line number Diff line number Diff line change 1+ # Licensed to Elasticsearch B.V. under one or more contributor
2+ # license agreements. See the NOTICE file distributed with
3+ # this work for additional information regarding copyright
4+ # ownership. Elasticsearch B.V. licenses this file to you under
5+ # the Apache License, Version 2.0 (the "License"); you may
6+ # not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
Original file line number Diff line number Diff line change 1+ name : License headers
2+ on : [pull_request]
3+ jobs :
4+ build :
5+ runs-on : ubuntu-latest
6+ steps :
7+ - uses : actions/checkout@v2
8+ - name : Check license headers
9+ run : |
10+ ./.github/check-license-headers.sh
You can’t perform that action at this time.
0 commit comments