CI: add tools to check ASF headers in code files (#26)

* add license check.

* Change the contents of the `Makefile`.

* add `license_ci` file.
diff --git a/.actions/ASF-Release.cfg b/.actions/ASF-Release.cfg
new file mode 100644
index 0000000..09678b8
--- /dev/null
+++ b/.actions/ASF-Release.cfg
@@ -0,0 +1,75 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements; and to You under the Apache License, Version 2.0.
+
+# scanCode.py configuration file
+
+# List of filenames containing the text of valid license (headers)
+# These files SHOULD be in the same directory path where scanCode.py
+# resides.
+[Licenses]
+ASFLicenseHeader.txt
+ASFLicenseHeaderBash.txt
+ASFLicenseHeaderMarkdown.txt
+ASFLicenseHeaderLua.txt
+
+# Filters (path/filename) with wildcards and associated scan checks
+# that are to be run against them.  The checks are actual valid
+# function names found in scanCode.py.
+[Includes]
+*=is_not_symlink, regex_check
+*.conf=has_block_license, eol_at_eof, regex_check
+*.go=has_block_license, eol_at_eof, regex_check
+*.md=no_tabs, has_block_license, eol_at_eof, regex_check
+*.properties=no_tabs, has_block_license, eol_at_eof, regex_check
+*.py=no_tabs, has_block_license, eol_at_eof, regex_check
+*.scala=has_block_license, no_tabs, eol_at_eof, regex_check
+*.sh=has_block_license, eol_at_eof, regex_check
+*.yaml=has_block_license, eol_at_eof, regex_check
+*.yml=has_block_license, eol_at_eof, regex_check
+*Dockerfile*=has_block_license
+
+# Sanity check files not required to have ASF headers because either they
+# are excluded or are not packaged with the Apache source release.
+*.cfg=regex_check
+*.ini=regex_check
+*.j2=regex_check
+*.json=regex_check
+*.txt=regex_check
+*.xml=regex_check
+
+# List of paths (inclusive of subdirectories) to exclude from code scanning
+[Excludes]
+
+# General tooling & binary file exclusions
+.bin
+.dockerignore
+.eslintrc.*
+.git
+.gitattributes
+.github
+.gitignore
+.gradle
+.idea
+.jshintrc
+.pydevproject
+.rat-excludes
+.tox
+
+# Exclude Apache standard legal files
+CREDITS.txt
+DISCLAIMER.txt
+LICENSE*.txt
+NOTICE.txt
+
+conf
+.actions/openwhisk-utilities
+
+[Options]
+# Not all code files allow licenses to appear starting at the first character
+# of the file. This option tells the scan to allow licenses to appear starting
+# within the first 'x' characters of each code file (as provided by this option's
+# value).
+LICENSE_SLACK_LENGTH=500
+
+# List of regular expressions for forbidden strings, e.g. \w+@company.com
+[Regex]
diff --git a/.actions/ASFLicenseHeaderMarkdown.txt b/.actions/ASFLicenseHeaderMarkdown.txt
new file mode 100644
index 0000000..c474814
--- /dev/null
+++ b/.actions/ASFLicenseHeaderMarkdown.txt
@@ -0,0 +1,18 @@
+<!--
+#
+# 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.
+#
+-->
diff --git a/.actions/openwhisk-utilities b/.actions/openwhisk-utilities
new file mode 160000
index 0000000..8636f9a
--- /dev/null
+++ b/.actions/openwhisk-utilities
@@ -0,0 +1 @@
+Subproject commit 8636f9ad3bb7c4ed216f6b9291b0a6bf9a12cb76
diff --git a/.github/workflows/license_ci.yml b/.github/workflows/license_ci.yml
new file mode 100644
index 0000000..28a222e
--- /dev/null
+++ b/.github/workflows/license_ci.yml
@@ -0,0 +1,23 @@
+name: LICENSE CI
+
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+    branches:
+      - master
+
+jobs:
+
+  check-license:
+
+    runs-on: ubuntu-latest
+
+    steps:
+
+    - uses: actions/checkout@v2
+
+    - name: run license check
+      run: |
+        make license-check
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1245ce7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+### license-check:    Check apisix-control-plane source code for Apache License
+.PHONY: license-check
+license-check:
+ifeq ("$(wildcard .actions/openwhisk-utilities/scancode/scanCode.py)", "")
+	git clone https://github.com/apache/openwhisk-utilities.git .actions/openwhisk-utilities
+	cp .actions/ASF* .actions/openwhisk-utilities/scancode/
+endif
+	.actions/openwhisk-utilities/scancode/scanCode.py --config .actions/ASF-Release.cfg ./
\ No newline at end of file
diff --git a/pkg/yml/plugin.go b/pkg/yml/plugin.go
index 129de0d..739940a 100644
--- a/pkg/yml/plugin.go
+++ b/pkg/yml/plugin.go
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+ 
 package yml
 
 import "github.com/apache/apisix-control-plane/pkg/mem"