forked from itsvs/no-merge-action
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
86 lines (86 loc) · 2.41 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const files = [
{
chunks: [
{
content: '@@ -0,0 +1,8 @@',
changes: [
{
type: 'add',
add: true,
ln: 1,
content: '+## Test only '
},
{
type: 'add',
add: true,
ln: 2,
content: '+ - should be deleted after testing'
},
{
type: 'add',
add: true,
ln: 3,
content: '+'
},
{
type: 'add',
add: true,
ln: 4,
content: '+## section'
},
{
type: 'add',
add: true,
ln: 5,
content: '+ - fake text'
},
{
type: 'add',
add: true,
ln: 6,
content: '+'
},
{
type: 'add',
add: true,
ln: 7,
content: '+## another section'
},
{
type: 'add',
add: true,
ln: 8,
content: '+ - another test'
}
],
oldStart: 0,
oldLines: 0,
newStart: 1,
newLines: 8
}
],
deletions: 0,
additions: 8,
from: '/dev/null',
to: 'flips/testing-no-commit.md',
new: true,
index: ['000000000..20da76a8d']
}
]
const keyword = `flips/`
let changes = ''
for (const file of files) {
if (file.to.indexOf(keyword) >= 0) {
console.log('no commit, files')
}
for (const chunk of file.chunks) {
for (const change of chunk.changes) {
if (change.add) {
changes += change.content
}
}
}
}
if (changes.indexOf(keyword) > -1) {
console.log("no commit, content")
}