Skip to content

Commit

Permalink
chore: release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zoomchan-cxj committed Aug 1, 2022
1 parent 766611b commit 8fb9a9e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 37 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
# actions-license

This action forked from [actions-license](https://github.com/thalleslmF/actions-license) and do some customization.

+ Use `fast-glob` to replace `glob` to improve performance.

+ Support `include` pattern configuration.

+ Support manually trigger workflow through specifying `commit-from` and `commit-to` ids.

+ `Date` check is optional.

# Usage

1. create `.github/license-check.json` or specify concrete path in `action inputs: config-path` like the following:

```
"copyright": [
"copyright": [ // Put your license here in a array format
"Copyright",
"Licensed under the **, Version 2.0 (the \"License\");", // Put your license here in a array format
"Licensed under the **, Version 2.0 (the \"License\");"
],
"include": [
"**/*.*" // Put the file pattern you want to include on the check, default is **/*.*
"include": [ // Put the file pattern you want to include on the check, default is **/*.*
"**/*.*"
],
"ignore": [
"**/node_modules/**", // Put the file pattern you want to ignore on the check
"ignore": [ // Put the file pattern you want to ignore on the check
"**/node_modules/**",
"**/.git/**",
"**/.gradle/**",
"**/.DS_Store/**",
"**/.nyc_output/**",
"**/.vscode/**",
"**/.vs/**",
"**/.idea/**",
"**/*.xcworkspace/**",
".github/**",
"docs/**"
"**/*.xcworkspace/**"
],
"startDateLicense": 2020 // Specify the license date to check, it is not required
```
Expand Down
26 changes: 3 additions & 23 deletions license-check.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,21 @@
{
"copyright": [
"Copyright",
"Licensed under the Apache License, Version 2.0 (the \"License\");"
"Licensed under the **, Version 2.0 (the \"License\");"
],
"include": [
"**/*.{ts,tsx,js,jsx,vue,ejs,mjs,.es6}",
"**/*.{css,less,scss}",
"**/*.{h,hpp,hh,h++,hxx}",
"**/*.{c,cc,c++,cpp,C,cxx}",
"**/*.{m,mm,swift,podspec}",
"**/*.{htm,html,xml,xhtm,xhtml}",
"**/*.cmake",
"**/*.java",
"**/*.cfg",
"**/*.txt",
"**/*.sh",
"**/*.yaml",
"**/*.bat",
"**/*.dart",
"**/*.py"
"**/*.*"
],
"ignore": [
"**/node_modules/**",
"**/AUTHORS/**",
"**/.git/**",
"**/.gradle/**",
"**/*.xcworkspace/**",
"**/.DS_Store/**",
"**/.nyc_output/**",
"**/.vscode/**",
"**/.vs/**",
"**/.idea/**",
"**/.externalNativeBuild/**",
"**/.cxx/**",
"docs/**",
".github/**",
".husky/**"
"**/*.xcworkspace/**"
],
"startDateLicense": 2020
}
3 changes: 1 addition & 2 deletions license.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ const checkLicense = async (fileNames, config) => {
const octokit = github.getOctokit(token);
const owner = github.context.payload.repository.owner.login;
const repo = github.context.payload.repository.name;
console.log(`original commit from ${commitFrom} to ${commitTo}`);
if (!commitFrom && !commitTo) {
const prNumber = github.context.payload.pull_request.number
config = {
Expand All @@ -132,8 +131,8 @@ const checkLicense = async (fileNames, config) => {
}));
commitFrom = responsePr.data.base.sha;
commitTo = responsePr.data.head.sha;
console.log(`pr commit from ${responsePr.data.base.sha} to ${responsePr.data.head.sha}`);
}
console.log(`commit from ${commitFrom} to ${commitTo}`);
if (!commitFrom || !commitTo) {
return {
title: `The range of commit ids is not correct`,
Expand Down
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const chalk = require('chalk')
const fs = require('fs');
const fg = require('fast-glob');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "file-license-checker",
"version": "0.0.4",
"version": "0.1.0",
"description": "",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit 8fb9a9e

Please sign in to comment.