This repository has been archived by the owner on Jun 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a2e998
commit 1c99e59
Showing
6 changed files
with
125 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* 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. | ||
*/ | ||
import { schedule, danger, fail, warn, message, markdown } from "danger"; | ||
import fs from "fs"; | ||
import path from 'path'; | ||
import GitHubApi from 'github'; | ||
import parseDiff from 'parse-diff'; | ||
import shell from "shelljs"; | ||
|
||
const type_unknown = 0; | ||
const type_c = 1; | ||
const type_android = 2; | ||
const type_js = 3; | ||
|
||
const getFileType = file => { | ||
if (file.match(/\.(m|h|mm|cpp|cc)/)) { | ||
return type_c; | ||
} else if (file.match(/\.java/)) { | ||
return type_android; | ||
} else if (file.match(/\.js/)) { | ||
return type_js; | ||
}else{ | ||
return type_unknown; | ||
} | ||
} | ||
|
||
var hasCFile = false; | ||
var hasAndroidFile = false; | ||
var hasJsFile = false; | ||
|
||
function check(file_type){ | ||
has_file_type = false; | ||
if (!has_file_type && danger.git.created_files) { | ||
danger.git.created_files.some(file => { | ||
var f = checkFileType(file) | ||
if(getFileType(file)==file_type){ | ||
has_file_type =f; | ||
} | ||
return f; | ||
}); | ||
} | ||
|
||
if (!has_file_type && danger.git.modified_files) { | ||
danger.git.created_files.some(file => { | ||
var f = checkFileType(file) | ||
if(getFileType(file)==file_type){ | ||
has_file_type =f; | ||
} | ||
return f; | ||
}); | ||
} | ||
|
||
if (!has_file_type && danger.git.deleted_files) { | ||
danger.git.created_files.some(file => { | ||
var f = checkFileType(file) | ||
if(getFileType(file)==file_type){ | ||
has_file_type =f; | ||
} | ||
return f; | ||
}); | ||
} | ||
|
||
return has_file_type | ||
} | ||
|
||
hasCFile = check(type_c) | ||
hasAndroidFile = check(type_android) | ||
hasJsFile = check(type_js) | ||
|
||
if(hasCFile){ | ||
console.log('hasIosFile'); | ||
} | ||
if(hasAndroidFile){ | ||
console.log('hasAndroidFile'); | ||
} | ||
if(hasJsFile){ | ||
console.log('hasJsFile'); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
Large diffs are not rendered by default.
Oops, something went wrong.
Submodule weex-playground
updated
4 files
+70 −0 | .travis.yml | |
+56 −0 | dangerfile-android.js | |
+2,516 −0 | package-lock.json | |
+24 −0 | package.json |