Organize GHA by header and dependency (#123)
diff --git a/README.md b/README.md
index 79343d2..a6791c6 100644
--- a/README.md
+++ b/README.md
@@ -12,19 +12,9 @@
### GitHub Actions
-To use License-Eye in GitHub Actions, add a step in your GitHub workflow.
+First of all, add a `.licenserc.yaml` in the root of your project, for Apache Software Foundation projects, the following configuration should be enough.
-```yaml
-- name: Check License Header
- uses: apache/skywalking-eyes@main # always prefer to use a revision instead of `main`.
- # with:
- # log: debug # optional: set the log level. The default value is `info`.
- # config: .licenserc.yaml # optional: set the config file. The default value is `.licenserc.yaml`.
- # token: # optional: the token that license eye uses when it needs to comment on the pull request. Set to empty ("") to disable commenting on pull request. The default value is ${{ github.token }}
- # mode: # optional: Which mode License-Eye should be run in. Choices are `check` or `fix`. The default value is `check`.
-```
-
-Add a `.licenserc.yaml` in the root of your project, for Apache Software Foundation projects, the following configuration should be enough.
+> **Note**: The full configurations can be found in [the configuration section](#configurations).
```yaml
header:
@@ -40,11 +30,31 @@
- 'NOTICE'
comment: on-failure
+
+# If you want to check dependencies' license compatibility, uncomment the following section
+# dependency:
+# files:
+# - pom.xml # If this is a maven project.
+# - Cargo.toml # If this is a rust project.
+# - package.json # If this is a npm project.
+# - go.mod # If this is a Go project.
```
-**NOTE**: The full configurations can be found in [the configuration section](#configurations).
+#### Check License Headers
-#### Using the Action in Fix Mode
+To check license headers in GitHub Actions, add a step in your GitHub workflow.
+
+```yaml
+- name: Check License Header
+ uses: apache/skywalking-eyes/header@main # always prefer to use a revision instead of `main`.
+ # with:
+ # log: debug # optional: set the log level. The default value is `info`.
+ # config: .licenserc.yaml # optional: set the config file. The default value is `.licenserc.yaml`.
+ # token: # optional: the token that license eye uses when it needs to comment on the pull request. Set to empty ("") to disable commenting on pull request. The default value is ${{ github.token }}
+ # mode: # optional: Which mode License-Eye should be run in. Choices are `check` or `fix`. The default value is `check`.
+```
+
+#### Fix License Headers
By default the action runs License-Eye in check mode, which will raise an error
if any of the processed files are missing license headers. If `mode` is set to
@@ -53,8 +63,8 @@
pull request using another GitHub action. For example:
```yaml
-- name: Check License Header
- uses: apache/skywalking-eyes@main
+- name: Fix License Header
+ uses: apache/skywalking-eyes/header@main
with:
mode: fix
- name: Apply Changes
@@ -67,10 +77,30 @@
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
-**Note**: The exit code of fix mode is always 0 and can not be used to block CI
+> **Warning**: The exit code of fix mode is always 0 and can not be used to block CI
status. Consider running the action in check mode if you would like CI to fail
when a file is missing a license header.
+> **Note**: In 0.3.0 and earlier versions, GitHub Actions `apache/skywalking-eyes`
+> only works for header check/fix, since 0.4.0, we have a dedicate GitHub Actions
+> `apache/skywalking-eyes/header` for header check/fix and a GitHub Actions
+> `apache/skywalking-eyes/dependency` for dependency resolve/check.
+> Now `apache/skywalking-eyes` is equivalent to `apache/skywalking-eyes/header` in
+> order not to break existing usages of `apache/skywalking-eyes`.
+
+#### Check Dependencies' License
+
+To check dependencies license in GitHub Actions, add a step in your GitHub workflow.
+
+```yaml
+- name: Check Dependencies' License
+ uses: apache/skywalking-eyes/dependency@main # always prefer to use a revision instead of `main`.
+ # with:
+ # log: debug # optional: set the log level. The default value is `info`.
+ # config: .licenserc.yaml # optional: set the config file. The default value is `.licenserc.yaml`.
+ # mode: # optional: Which mode License-Eye should be run in. Choices are `check` or `resolve`. The default value is `check`.
+```
+
### Docker Image
```shell
diff --git a/action.yml b/action.yml
index e8eef71..d33a37a 100644
--- a/action.yml
+++ b/action.yml
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-name: License Eye
+name: License Eye Header
description: A full-featured license tool to check and fix license headers and dependencies' licenses.
branding:
icon: book
@@ -43,7 +43,7 @@
default: check
runs:
using: docker
- image: Dockerfile
+ image: ../Dockerfile
env:
GITHUB_TOKEN: ${{ inputs.token }}
args:
diff --git a/dependency/action.yml b/dependency/action.yml
new file mode 100644
index 0000000..16d273a
--- /dev/null
+++ b/dependency/action.yml
@@ -0,0 +1,47 @@
+# 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.
+
+name: License Eye Dependency
+description: A full-featured license tool to check and fix license headers and dependencies' licenses.
+branding:
+ icon: book
+ color: orange
+inputs:
+ log:
+ description: The level of log, for example, "debug" or "info"
+ required: false
+ default: info
+ config:
+ description: The configuration file, for example, ".licenserc.yaml"
+ required: false
+ default: .licenserc.yaml
+ mode:
+ description: |
+ Which mode License Eye should be run in. Choices are `check` or `resolve`. The
+ default value is `check`.
+ required: false
+ default: check
+runs:
+ using: docker
+ image: ../Dockerfile
+ args:
+ - -v
+ - ${{ inputs.log }}
+ - -c
+ - ${{ inputs.config }}
+ - dependency
+ - ${{ inputs.mode }}
diff --git a/header/action.yml b/header/action.yml
new file mode 100644
index 0000000..d33a37a
--- /dev/null
+++ b/header/action.yml
@@ -0,0 +1,55 @@
+# 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.
+
+name: License Eye Header
+description: A full-featured license tool to check and fix license headers and dependencies' licenses.
+branding:
+ icon: book
+ color: orange
+inputs:
+ log:
+ description: The level of log, for example, "debug" or "info"
+ required: false
+ default: info
+ config:
+ description: The configuration file, for example, ".licenserc.yaml"
+ required: false
+ default: .licenserc.yaml
+ token:
+ description: |
+ The token that license eye uses when it needs to comment on the pull request.
+ Set to empty ("") to disable commenting on pull request.
+ required: false
+ default: ${{ github.token }}
+ mode:
+ description: |
+ Which mode License Eye should be run in. Choices are `check` or `fix`. The
+ default value is `check`.
+ required: false
+ default: check
+runs:
+ using: docker
+ image: ../Dockerfile
+ env:
+ GITHUB_TOKEN: ${{ inputs.token }}
+ args:
+ - -v
+ - ${{ inputs.log }}
+ - -c
+ - ${{ inputs.config }}
+ - header
+ - ${{ inputs.mode }}