mirror of
https://github.com/tj-actions/changed-files
synced 2025-07-03 10:12:56 +02:00
Compare commits
1023 commits
Author | SHA1 | Date | |
---|---|---|---|
|
e8772ff27d | ||
|
8917c3a23b | ||
|
8e3d814e36 | ||
|
6da46bc98b | ||
|
95dea818c4 | ||
|
6b214c1237 | ||
|
666c9d2900 | ||
|
d52d20fa3f | ||
|
f1c0eb9599 | ||
|
944a0f7239 | ||
|
3dbc1e1812 | ||
|
7a7221b7ba | ||
|
c260d49a82 | ||
|
b1ccff8c08 | ||
|
a892f50f7a | ||
|
5ca5422070 | ||
|
4140eb99d2 | ||
|
115870536a | ||
|
48aea2e1ab | ||
|
050a3d3360 | ||
|
f000a9b97f | ||
|
7a9a6d2105 | ||
|
abda8aa2d0 | ||
|
c6634ca281 | ||
|
860b02dbf9 | ||
|
3981e4f741 | ||
|
403a8a6fd1 | ||
|
5c5e8c9b88 | ||
|
d869acea43 | ||
|
480f494126 | ||
|
405524a214 | ||
|
b6970c44e6 | ||
|
11fe0a2263 | ||
|
e7b157b1c4 | ||
|
9132e0305b | ||
|
4168bb487d | ||
|
5426ecc3f5 | ||
|
513a44e609 | ||
|
46e217dc3e | ||
|
c34c1c13a7 | ||
|
52c3beb997 | ||
|
ea3010bc88 | ||
|
be393a9038 | ||
|
9b4bb2bedb | ||
|
9934ab3fdf | ||
|
db731a131c | ||
|
ed68ef82c0 | ||
|
a7bc14b808 | ||
|
3d751f6b6d | ||
|
e2fda4ec3c | ||
|
0bed1b1132 | ||
|
68024587dc | ||
|
cf2e39e86b | ||
|
6abeaa506a | ||
|
6f67ee9ac8 | ||
|
6cb76d07be | ||
|
b74df86ccb | ||
|
27ae6b33ea | ||
|
823fcebdb3 | ||
|
8132356842 | ||
|
7a369a7175 | ||
|
9468856c22 | ||
|
401c7227d1 | ||
|
41e0de576a | ||
|
945787811a | ||
|
26a38635fc | ||
|
a530a27a79 | ||
|
9cc867cd4a | ||
|
3a33fa99ab | ||
|
a5cad85977 | ||
|
f2f439bb2f | ||
|
678ecec172 | ||
|
6482371e86 | ||
|
0b975f6148 | ||
|
0fee5fb278 | ||
|
531f5f7d16 | ||
|
dccd1949ad | ||
|
9237eb7a0f | ||
|
d52b942ee0 | ||
|
45fb12d7a8 | ||
|
2f7c5bfce2 | ||
|
4189ec62c4 | ||
|
4cd184a1dd | ||
|
5cbf22026d | ||
|
0f1ffe6185 | ||
|
ddef03e37c | ||
|
9c2df0d54a | ||
|
65253327cf | ||
|
e37e952786 | ||
|
a284dc1814 | ||
|
9200e69727 | ||
|
e650cfdae5 | ||
|
82af21f4a0 | ||
|
82fa4a6402 | ||
|
315505acf4 | ||
|
c8e1cdb9ea | ||
|
bb6d1aa002 | ||
|
1f74fc9653 | ||
|
6f0fde1f0c | ||
|
056cdb7fc8 | ||
|
4bc859529c | ||
|
86d954fb8e | ||
|
33dce23cbf | ||
|
422be0138a | ||
|
601adb19b6 | ||
|
09f0e695d4 | ||
|
c7e81c8967 | ||
|
02e0175004 | ||
|
251f07ed52 | ||
|
fb8dcda5fb | ||
|
6fe3586909 | ||
|
df76a83fcb | ||
|
faaeb86b22 | ||
|
4919c5ae14 | ||
|
045c5414a3 | ||
|
563041e49c | ||
|
809f04b20a | ||
|
b1ba699b30 | ||
|
dcc7a0cba8 | ||
|
364748aaa8 | ||
|
301bed650e | ||
|
be1c47003f | ||
|
81785a6716 | ||
|
065e671731 | ||
|
45cd7f3ddd | ||
|
47f21ba558 | ||
|
3b3041225b | ||
|
eec6665cfd | ||
|
cefd9aa220 | ||
|
6296564d94 | ||
|
203f0af1aa | ||
|
8b824429a7 | ||
|
2b7a1ec20e | ||
|
a2600ce61d | ||
|
5dc51d3407 | ||
|
18de9f341f | ||
|
467e548138 | ||
|
556e62ac76 | ||
|
4f1e6b0db0 | ||
|
7b72c97d73 | ||
|
82deec73be | ||
|
ef7202db4d | ||
|
01c978c0f8 | ||
|
ed8e9f69ee | ||
|
d6e91a2266 | ||
|
73401cd676 | ||
|
7f28b2be82 | ||
|
c1f82ce4ba | ||
|
5f974c28f5 | ||
|
bb364ec4c8 | ||
|
7ac5902a02 | ||
|
7c5097f4aa | ||
|
37dc9a5e30 | ||
|
515a6b35d1 | ||
|
ac47125d2d | ||
|
ef3b6f1fa5 | ||
|
8082fbc636 | ||
|
bab30c2299 | ||
|
657a3f914f | ||
|
05f0aba931 | ||
|
462396174f | ||
|
c19a7eb771 | ||
|
c288441a7d | ||
|
1d6ea46cac | ||
|
02b41f5ff9 | ||
|
b4a4dcabce | ||
|
602aacf949 | ||
|
51290e039a | ||
|
b4badd8cce | ||
|
652b4c06e8 | ||
|
0b7a421316 | ||
|
b26581aca1 | ||
|
43e6b45c5d | ||
|
fe1bc0e3d3 | ||
|
d7917c6584 | ||
|
3f646a3549 | ||
|
6809677b7a | ||
|
4edd678ac3 | ||
|
f08255874b | ||
|
92c02a00a1 | ||
|
b70221184d | ||
|
435fd74b2e | ||
|
0626fa3ff3 | ||
|
8817a797cb | ||
|
54174910be | ||
|
84ef162530 | ||
|
b672a5115a | ||
|
678cdc2808 | ||
|
27b7bbb0ae | ||
|
83610723bb | ||
|
21acf46f4a | ||
|
f356b3c86b | ||
|
66275de060 | ||
|
a16702bf7a | ||
|
aa11897ec4 | ||
|
6513fe1691 | ||
|
45e0c78ac7 | ||
|
a949a8338c | ||
|
1f772e919b | ||
|
684c5e6d94 | ||
|
9d7201ded6 | ||
|
f93ff33629 | ||
|
729c70475c | ||
|
2009d446ac | ||
|
b693fc207f | ||
|
0104c75ccc | ||
|
4d0aab94b6 | ||
|
df3e9932c4 | ||
|
c3a1bb2c99 | ||
|
27843f1667 | ||
|
36d5b9dda5 | ||
|
9d4f8fea58 | ||
|
d0cf1645b7 | ||
|
641e22af4a | ||
|
8a4a9757b7 | ||
|
6bfa9e7a9a | ||
|
625dbd682e | ||
|
1a71128b6a | ||
|
c29c1d3dd0 | ||
|
e753fb0a63 | ||
|
e21f1a3077 | ||
|
792230fced | ||
|
4dbe54f96e | ||
|
537f1c6318 | ||
|
82587d8858 | ||
|
eda64a62bd | ||
|
4d5444c2c3 | ||
|
c2e104be2f | ||
|
eed685a419 | ||
|
6f538bb83f | ||
|
48d8f15b2a | ||
|
f4e06529f1 | ||
|
9b5f7d7ff5 | ||
|
80dc58425e | ||
|
f9216b6d97 | ||
|
fef272dc40 | ||
|
a236bf57ea | ||
|
0cb58dec12 | ||
|
44f3356296 | ||
|
1d9fdda44c | ||
|
ca746c1dbe | ||
|
2414c5b001 | ||
|
e73bb10d96 | ||
|
c7114f61a1 | ||
|
38cc85fd79 | ||
|
834406f361 | ||
|
5d8e41f17c | ||
|
a78c1f5db4 | ||
|
5977012387 | ||
|
e9772d1404 | ||
|
880354d0c6 | ||
|
8d5497eb10 | ||
|
696bea0add | ||
|
bd7d572708 | ||
|
305db886e7 | ||
|
17107f43d7 | ||
|
2d4c94f488 | ||
|
bf02379775 | ||
|
0d320382bc | ||
|
40853de9f8 | ||
|
94b94fea13 | ||
|
f8034fbb84 | ||
|
b4c0974161 | ||
|
246859db91 | ||
|
46a4c027a6 | ||
|
525aabbe28 | ||
|
25b256207d | ||
|
257f12c17b | ||
|
598b7212f2 | ||
|
88201be733 | ||
|
9b7ba7b107 | ||
|
3ea85a1c0d | ||
|
50693d8df5 | ||
|
87d8f9488b | ||
|
950331d47c | ||
|
ed00b69562 | ||
|
9d768c3d4e | ||
|
6b79c79980 | ||
|
99b60a2a91 | ||
|
8ae850f052 | ||
|
71038002e0 | ||
|
03d95b07db | ||
|
c65cd88342 | ||
|
9f928e3005 | ||
|
fb1b47b727 | ||
|
a77ecbc238 | ||
|
e4fe134b73 | ||
|
f5a7145f2b | ||
|
10471793b2 | ||
|
28fd03b28d | ||
|
4db04c76fa | ||
|
f79274f27b | ||
|
f1d2215d5d | ||
|
6b2903bdce | ||
|
dc82617b24 | ||
|
1797e9a1ea | ||
|
56b5e13a32 | ||
|
9e63ef55ed | ||
|
f1afcaced6 | ||
|
e42a3d1b0a | ||
|
f0eedff362 | ||
|
f6d7b721fd | ||
|
6f59461624 | ||
|
443dcaf814 | ||
|
6f8dfa84e8 | ||
|
df7dd40375 | ||
|
07a5a99344 | ||
|
02a0746337 | ||
|
75ed46d235 | ||
|
c8c9e91b48 | ||
|
8ead8a4214 | ||
|
0f83d09356 | ||
|
c3dcd3e758 | ||
|
0e9a58eebf | ||
|
2295558b65 | ||
|
68447960ff | ||
|
00518ab39d | ||
|
2c2260e690 | ||
|
9adb9156b8 | ||
|
d1d479f03c | ||
|
cc733854b1 | ||
|
0b99ecfd4e | ||
|
cc3bbb0c52 | ||
|
373db58d9d | ||
|
9161a8dcde | ||
|
e13fb92d45 | ||
|
7891350b8e | ||
|
457e041909 | ||
|
eaf854ef0c | ||
|
681bf92506 | ||
|
3ec883ad31 | ||
|
e5740c1ffc | ||
|
bbe7f7b544 | ||
|
205913dc0c | ||
|
dd73690e2e | ||
|
c226cd45e5 | ||
|
facb2785cd | ||
|
4b558a92db | ||
|
5f68aa8f2d | ||
|
0da22a2fef | ||
|
2972fe4d6b | ||
|
57a81a39f3 | ||
|
1d8732f877 | ||
|
3de07763cf | ||
|
b53f3b80e1 | ||
|
4f8f7b39ce | ||
|
ff86e79932 | ||
|
14c7f454e7 | ||
|
cda0f1d381 | ||
|
d44c8e3205 | ||
|
6b3dabec4c | ||
|
bce8e36722 | ||
|
b376795801 | ||
|
d41df78c17 | ||
|
4ae1154663 | ||
|
60268df189 | ||
|
f52993ba02 | ||
|
3b13fed1b0 | ||
|
338ea071b0 | ||
|
25cb66210f | ||
|
d6babd6899 | ||
|
0a79e54e1f | ||
|
9d06a2a6a9 | ||
|
7e8e88bd35 | ||
|
b510737b96 | ||
|
2e70979353 | ||
|
625929d27d | ||
|
03334d095e | ||
|
8a0655f075 | ||
|
98e187efcd | ||
|
96f65726ea | ||
|
bf548e4af2 | ||
|
8b07fd3b11 | ||
|
d195e6e7c2 | ||
|
1754cd4b9e | ||
|
03c184259a | ||
|
5f0139347a | ||
|
58a98867a7 | ||
|
9216b0cec2 | ||
|
0e3a6c3e99 | ||
|
e86678fe3a | ||
|
35d5a4d79f | ||
|
887f93673c | ||
|
a29e8b5656 | ||
|
5a127050b2 | ||
|
581934340b | ||
|
5587afbef7 | ||
|
0f039f361b | ||
|
6d4230d4f0 | ||
|
1711887607 | ||
|
c393672835 | ||
|
396e5a51d5 | ||
|
47a2d62412 | ||
|
c73b12cc6d | ||
|
41ce994be9 | ||
|
192e174507 | ||
|
5e85e31a01 | ||
|
7871e848ad | ||
|
15fa7fb955 | ||
|
1c5b7dc5f4 | ||
|
4765b9f775 | ||
|
0c82494d63 | ||
|
7d02310f6e | ||
|
0df48f8409 | ||
|
b76e23c88a | ||
|
549c203ec2 | ||
|
cee950d742 | ||
|
44ce9f4341 | ||
|
7b65c377b1 | ||
|
532b66aa5c | ||
|
d9384bba72 | ||
|
461ea4f9bf | ||
|
0874344d6e | ||
|
9f8300f8b4 | ||
|
a06b9e80ae | ||
|
4c5f5d698f | ||
|
07c64e5618 | ||
|
5bd333239b | ||
|
831e892562 | ||
|
e052d30e1c | ||
|
23a449039c | ||
|
60e2739e15 | ||
|
0f319d7425 | ||
|
d477ae513d | ||
|
5891cbdfd5 | ||
|
c9eaa5c000 | ||
|
fd91508dbb | ||
|
e8a7e82269 | ||
|
159b05372c | ||
|
635f118699 | ||
|
634b61511e | ||
|
77fcf43160 | ||
|
5f084a52a4 | ||
|
ff2cb1b4f2 | ||
|
5d5da31340 | ||
|
29bc0d3fd9 | ||
|
c9f9d5784e | ||
|
a4fba0109c | ||
|
8a6546164a | ||
|
bad2eb6859 | ||
|
b2dbd4264a | ||
|
57d40e662d | ||
|
185549c022 | ||
|
f853fd0592 | ||
|
cd3c6e6bbd | ||
|
e5ce44a301 | ||
|
ccdcd17ffd | ||
|
e4b8dafc5d | ||
|
2d756ea4c5 | ||
|
ce497c39e9 | ||
|
2d21bbb405 | ||
|
90941b398f | ||
|
2ca8dc42f6 | ||
|
ee096d679e | ||
|
4621617d4b | ||
|
4bbd49b998 | ||
|
c6557ed000 | ||
|
f0e7702ccc | ||
|
6354e6c542 | ||
|
117616472f | ||
|
4ff79362e5 | ||
|
0713a11242 | ||
|
064742427d | ||
|
efe5e6c7a4 | ||
|
01e9662a12 | ||
|
20576b4b9e | ||
|
077b23f6a6 | ||
|
02768050b1 | ||
|
427adf47f0 | ||
|
5c6aa49478 | ||
|
aa0b62a2d0 | ||
|
0320702dd5 | ||
|
38903688b4 | ||
|
98a74d2cd6 | ||
|
068000d9c6 | ||
|
490ac3999e | ||
|
2859a60726 | ||
|
d03038e4e4 | ||
|
77af4bed28 | ||
|
a5cf6aa30c | ||
|
15807c9c84 | ||
|
dc458cf753 | ||
|
92ca3eebd0 | ||
|
f591d0c7f0 | ||
|
35023362e2 | ||
|
e436cb6d85 | ||
|
257d47dfba | ||
|
4918e11830 | ||
|
aa08304bd4 | ||
|
008ba8ceec | ||
|
fe6c3ea0ca | ||
|
7fc073d922 | ||
|
7e4bfc2f1f | ||
|
ef3a7f51d6 | ||
|
a65c2f2100 | ||
|
ea042d8095 | ||
|
8293f8c984 | ||
|
0ff732eeb3 | ||
|
8df6fc260f | ||
|
d516645658 | ||
|
2c97e7ea24 | ||
|
1c8e606958 | ||
|
74605cb326 | ||
|
aa15b58e8a | ||
|
0a392e7438 | ||
|
85efc7df8e | ||
|
2a095d24c2 | ||
|
ac3dc5e392 | ||
|
dd7e9d3b17 | ||
|
0647a31f54 | ||
|
9d67dd3dbe | ||
|
5acd7e3646 | ||
|
9f4af73d05 | ||
|
800a282599 | ||
|
31c4d150e6 | ||
|
2a2a5b6b9c | ||
|
d8dcc13244 | ||
|
639ce0e105 | ||
|
9d447b9959 | ||
|
83bfc72efa | ||
|
879c8388c8 | ||
|
bb7502bd15 | ||
|
5c5539ced9 | ||
|
c2039de114 | ||
|
0cbc9bc448 | ||
|
9ef20a69dd | ||
|
a617853c0f | ||
|
5c1bceb76c | ||
|
3f54ebb830 | ||
|
6f070cff38 | ||
|
ec75ae5ab7 | ||
|
4333ab5b20 | ||
|
e3cac49049 | ||
|
68bd4537bd | ||
|
f0ce41b71c | ||
|
ce451bf430 | ||
|
7592e9e855 | ||
|
999653c672 | ||
|
6cf4c21fdf | ||
|
09ee51bee3 | ||
|
8eced8a5df | ||
|
13fa1402a7 | ||
|
07ac0ac168 | ||
|
049d7fd639 | ||
|
2e90fbb74b | ||
|
2a9db54a6d | ||
|
d0d5671ef7 | ||
|
97120ff1f5 | ||
|
b2d4e1b488 | ||
|
9299962a59 | ||
|
ea35f7ea00 | ||
|
3399f8837f | ||
|
ac897da4f1 | ||
|
8e56bc097a | ||
|
f6d3fe5179 | ||
|
efa99ea361 | ||
|
6d8f9bd379 | ||
|
589fb70c81 | ||
|
7daee9e7cf | ||
|
99c80bdd47 | ||
|
5e7cbf5fdb | ||
|
b4d6d28988 | ||
|
8370e6e6ef | ||
|
aa31060851 | ||
|
54c56103aa | ||
|
e57fb1b8eb | ||
|
926735a61e | ||
|
d3ac2a064b | ||
|
91df40b882 | ||
|
28396e9658 | ||
|
3a66e2a7e4 | ||
|
35f3202fd5 | ||
|
2b30af482a | ||
|
a93bcf46e0 | ||
|
6d4c555c7d | ||
|
507a8c703d | ||
|
3a7052c24a | ||
|
782eb123a9 | ||
|
9134dac8f6 | ||
|
df12603b45 | ||
|
bb9b5e8363 | ||
|
31b9c0a541 | ||
|
ba0a561b13 | ||
|
8d35cbb00f | ||
|
82dd6547dc | ||
|
6d42539842 | ||
|
08dedfb681 | ||
|
f6d9fa10e0 | ||
|
9eb0d763ae | ||
|
51d2f88f07 | ||
|
90a06d6ba9 | ||
|
2cb2c9234e | ||
|
ac21d93904 | ||
|
a4637ea6e7 | ||
|
fd9998cf5f | ||
|
ea024b2d7f | ||
|
db4e584844 | ||
|
c6543c497a | ||
|
88f9f3efbb | ||
|
3af07c2040 | ||
|
3680129aa2 | ||
|
5d866cbe77 | ||
|
346f237a17 | ||
|
c037f1e7c5 | ||
|
ae82ed4ae0 | ||
|
cbd59070e8 | ||
|
6c9dcea443 | ||
|
79b060d445 | ||
|
434b67ebc3 | ||
|
cbda684547 | ||
|
3f8189989b | ||
|
67a1f54f6f | ||
|
99248a4438 | ||
|
878743189b | ||
|
98d1d84e2f | ||
|
a60bf3759e | ||
|
bc46e4c422 | ||
|
fba4067348 | ||
|
e4b8674732 | ||
|
bc2b5aef20 | ||
|
63c36a563a | ||
|
44b77505fe | ||
|
62f4729b5d | ||
|
e0579abf95 | ||
|
8e0194b29b | ||
|
3649d2842d | ||
|
0ca1c07b47 | ||
|
a57f4dcc81 | ||
|
9c39b0b6e9 | ||
|
8b141f3906 | ||
|
17e07d8bc0 | ||
|
13fa1c06fc | ||
|
0deb29d192 | ||
|
28267ee8b7 | ||
|
094d3441f8 | ||
|
aeec36b035 | ||
|
2d0270c489 | ||
|
0e0adfa0d3 | ||
|
5313e6bbe3 | ||
|
54789be3a1 | ||
|
1675238cfd | ||
|
3fbf5fb588 | ||
|
95230678db | ||
|
fdccafbb6e | ||
|
0e8d796ee0 | ||
|
0c6f2ac488 | ||
|
1db97adba4 | ||
|
fb8f6db383 | ||
|
efd7ecef11 | ||
|
4f8e12c098 | ||
|
032add13e8 | ||
|
0f0747e79d | ||
|
0c2a758b81 | ||
|
1b6d7b6fb6 | ||
|
716b1e1304 | ||
|
7aaf10d9ee | ||
|
cc08e170f4 | ||
|
6e79d6e3db | ||
|
d13ac1942f | ||
|
bb89f97963 | ||
|
1864078d0a | ||
|
f495a0321d | ||
|
47371c50e9 | ||
|
4f573fed06 | ||
|
ff2f6e6b91 | ||
|
0102c07446 | ||
|
089842a7a8 | ||
|
787db0612e | ||
|
4ef6b56482 | ||
|
f9480db177 | ||
|
c9ae347dbb | ||
|
56284d8081 | ||
|
35ad6787f5 | ||
|
ca0db0ea03 | ||
|
03fcd0b3bb | ||
|
35da2a2e01 | ||
|
2329d9fb48 | ||
|
154ca89d2e | ||
|
449352f10e | ||
|
7c1826332f | ||
|
af2816c654 | ||
|
88be287f56 | ||
|
5513a5e205 | ||
|
e7023fa1da | ||
|
46550b6fd9 | ||
|
9454999946 | ||
|
7611ff348d | ||
|
187cf1e88c | ||
|
e1e532cff0 | ||
|
dfecec4fb7 | ||
|
c116f52a15 | ||
|
0b0b6429e1 | ||
|
f732c371a4 | ||
|
04c00459a2 | ||
|
5cee511ba5 | ||
|
399525a994 | ||
|
c075bd2719 | ||
|
208b83f295 | ||
|
ccb109a584 | ||
|
2918913341 | ||
|
a66176714d | ||
|
95642a1ebb | ||
|
726e06f8ef | ||
|
d96fe5d997 | ||
|
4ae611e5c5 | ||
|
1c938490c8 | ||
|
ba558db977 | ||
|
bf19fa23a6 | ||
|
66b77cbd0c | ||
|
10bfa980b7 | ||
|
9e46b4f7f7 | ||
|
3bf6172534 | ||
|
45581f0044 | ||
|
9ebb48b57a | ||
|
4e2dca3ba5 | ||
|
af6bdde59a | ||
|
fc1fb2b582 | ||
|
883b4ccbdb | ||
|
f91c9fe8b1 | ||
|
3ca6b80013 | ||
|
ee5ef758aa | ||
|
42fe158594 | ||
|
48427afe26 | ||
|
5c74583cb3 | ||
|
742ed362b6 | ||
|
44d340e48c | ||
|
2561448da0 | ||
|
86cabf5ea2 | ||
|
b5fc67a4f5 | ||
|
0b22a52bff | ||
|
da093c1609 | ||
|
c634be959b | ||
|
2139fa1b6f | ||
|
6784c9e1ee | ||
|
607d5ddbbf | ||
|
d588360bfe | ||
|
90f2c0c1b1 | ||
|
0d6e9b7196 | ||
|
8f90cc165a | ||
|
75758bc65f | ||
|
066e72a5fb | ||
|
c23e564e67 | ||
|
c0080255e3 | ||
|
3a3d3a2b86 | ||
|
79ef9d3fee | ||
|
da4597ee22 | ||
|
9f4ec1c14f | ||
|
4da6e32cfe | ||
|
7f1c4cb6db | ||
|
939fbca781 | ||
|
9ba175ae24 | ||
|
f7779a6302 | ||
|
05bdc91228 | ||
|
6d07b6ee59 | ||
|
1cf54bb5d3 | ||
|
21b4a4bc7b | ||
|
658f397297 | ||
|
38a0c329bb | ||
|
b0be21b8df | ||
|
97825a1994 | ||
|
13189f9e52 | ||
|
2a9f067522 | ||
|
ad01f6fdba | ||
|
b082611680 | ||
|
a36c479373 | ||
|
90a4f2a326 | ||
|
41ff1f2249 | ||
|
b20ce84763 | ||
|
875213d4a9 | ||
|
71b57652f0 | ||
|
834b86247e | ||
|
d8d3669cb3 | ||
|
940b170a31 | ||
|
55b93d0734 | ||
|
25ef3926d1 | ||
|
4d33bd5f9c | ||
|
f25e47258b | ||
|
a3c4ccbde0 | ||
|
b114534101 | ||
|
303f064ba9 | ||
|
e981e53b7f | ||
|
d850ef91f7 | ||
|
8701b586f3 | ||
|
9b1ba9a603 | ||
|
18c8a4eceb | ||
|
892553a457 | ||
|
50a9cc9b7b | ||
|
c300d15dae | ||
|
c076064636 | ||
|
40526807ee | ||
|
a59bf8ffcf | ||
|
6821899764 | ||
|
bfc49f4cff | ||
|
7549e1e4b9 | ||
|
2fc653d87d | ||
|
273a7c1641 | ||
|
905fcf74f4 | ||
|
229fe310d2 | ||
|
85073ea010 | ||
|
e622bd9227 | ||
|
003b42ec7f | ||
|
0a5a862874 | ||
|
1864dc5311 | ||
|
1be6574035 | ||
|
51bc7ab145 | ||
|
b49b468c28 | ||
|
8055b31e95 | ||
|
c371c6f055 | ||
|
7448ec4f69 | ||
|
d1f3041043 | ||
|
d0064d8549 | ||
|
4270b9fd4b | ||
|
cd07d32e58 | ||
|
33ddc07d8b | ||
|
1c7fbaba14 | ||
|
af292f1e84 | ||
|
2ddcb04986 | ||
|
3ce5a2970f | ||
|
d898dd09e4 | ||
|
0e08afd95d | ||
|
955cdc8d81 | ||
|
e48cacbca5 | ||
|
5aee572571 | ||
|
c83cb31f5b | ||
|
fea790cb66 | ||
|
794c26fb9f | ||
|
0f6525cd7d | ||
|
28cf22057f | ||
|
faedee1163 | ||
|
4a7ca97de0 | ||
|
cef68eee2e | ||
|
40e81cc72b | ||
|
4d1f5becef | ||
|
c82b7e2992 | ||
|
02eb5a78aa | ||
|
2cee40ea93 | ||
|
5b02f7c186 | ||
|
2e7f228016 | ||
|
8a78ebb29f | ||
|
95690f9ece | ||
|
97266423db | ||
|
af4b210111 | ||
|
2a10bef1b4 | ||
|
5c45808ea0 | ||
|
a82ffc67b3 | ||
|
44225688bb | ||
|
f144a9e6da | ||
|
d08f64adf6 | ||
|
2d0db8be9e | ||
|
408093d9ff | ||
|
a8fcc78511 | ||
|
49e754c81d | ||
|
3b9406ef82 | ||
|
1d9d8f4a76 | ||
|
6777efe3ca | ||
|
2b4a057e15 | ||
|
1e88b750d4 | ||
|
57421690e0 | ||
|
1c14cc7ff3 | ||
|
54864d4c3b | ||
|
8f6e85fcdf | ||
|
6cd5b66101 | ||
|
3729bf289f | ||
|
db153baf73 | ||
|
344b35fc53 | ||
|
f318653745 | ||
|
3415b43780 | ||
|
15f38d6693 | ||
|
2160c8e998 | ||
|
39084f937a | ||
|
22a6a7dedc | ||
|
8f93691a81 | ||
|
c5c7d8163f | ||
|
e061de58da | ||
|
6f90eecfe8 | ||
|
4daaa8171d | ||
|
cbff9146e3 | ||
|
2d7c10954b | ||
|
6e74c9dbbb | ||
|
44827f39da | ||
|
2ba385a5e1 | ||
|
7d9358afc1 | ||
|
cf03855076 | ||
|
877b5ce98c | ||
|
428220b7f4 | ||
|
914e0223cf | ||
|
b79cd45602 | ||
|
19107de46c | ||
|
29dd1b9c76 | ||
|
dac82b0e15 | ||
|
4595c4c56b | ||
|
39000e536b | ||
|
181ee9b66b | ||
|
9053f9ea11 | ||
|
8238a41032 | ||
|
aaf4339aa1 | ||
|
d2486b470f | ||
|
e7fd9e59a4 | ||
|
e3cc088a96 | ||
|
72d7089b72 | ||
|
e94da5a065 | ||
|
a721d001dd | ||
|
8af3110d4d | ||
|
a351a301d2 | ||
|
62a23f82b1 | ||
|
ef42e5ad18 | ||
|
cd1e384723 | ||
|
a52f8621d2 | ||
|
920856cfdd | ||
|
08906b3254 | ||
|
cd35eace22 | ||
|
8296c33fd0 | ||
|
0ad71b9855 | ||
|
c98e6d20fc | ||
|
2398551415 | ||
|
060b3b9b03 | ||
|
ff65504325 | ||
|
543c1a25c6 | ||
|
1be42003d7 | ||
|
2325baada3 | ||
|
e6ce728d79 | ||
|
0b947ed818 | ||
|
e8dbf6d670 | ||
|
41c232aad8 | ||
|
4196030939 | ||
|
bbe796033e | ||
|
159562dc02 | ||
|
a21a533a0c | ||
|
eeb169a9f9 | ||
|
951140b94a | ||
|
dbf0700c7a | ||
|
dacbaebcaf | ||
|
36ab2fe9c2 | ||
|
7e3a4bac80 | ||
|
dcbe9805f4 | ||
|
fd73c1248c | ||
|
8e79ba7ab9 | ||
|
5db7b578d5 | ||
|
a17e8c5252 | ||
|
d1e9506b19 | ||
|
1fdfe0928a | ||
|
76c4d81a6a | ||
|
d8904df6c5 | ||
|
662c03ea61 | ||
|
c8b7da7226 | ||
|
249c1698c5 | ||
|
17352b2176 | ||
|
e8e6614779 | ||
|
ad4b06d999 | ||
|
b1a34eb336 | ||
|
d9a6ccb099 | ||
|
090eb05f17 | ||
|
690bef673a | ||
|
fb8d2c9c29 | ||
|
bb3b39cd33 | ||
|
001f56257c | ||
|
57245a9721 | ||
|
6ee9cdc581 | ||
|
dc40835d4d | ||
|
7e3122dc95 | ||
|
073479583b | ||
|
d76ddeeeaa | ||
|
7cdc56dd7a | ||
|
246636f5fa | ||
|
fe0fb71961 | ||
|
e60a7a9173 | ||
|
81bb5d8954 | ||
|
523e8b6f11 | ||
|
4a0a3c4aa5 | ||
|
9dfd3f686b | ||
|
796ac2d08f | ||
|
534262e0b2 | ||
|
673189f77b | ||
|
89cb9ea919 | ||
|
7113206187 | ||
|
926a3fd777 | ||
|
de23f62d1e | ||
|
afbabc4364 | ||
|
eda0811ed2 | ||
|
bda67fc879 | ||
|
5a5d398e5f | ||
|
f699bde5ad | ||
|
48566bbcc2 | ||
|
d68a6666be | ||
|
07660d51a9 | ||
|
632c84dcca | ||
|
1aee3621b1 | ||
|
8d335b7b7d | ||
|
fd460fa3ba | ||
|
5b84ed26a3 | ||
|
e03c026bf4 | ||
|
5704310356 | ||
|
c922361eb2 | ||
|
48576e6584 | ||
|
79d644d1a2 | ||
|
2f7246cb26 | ||
|
8476756ae3 | ||
|
d90c240f2a | ||
|
3be651e99d | ||
|
4fac98a656 | ||
|
bed56b29b8 | ||
|
2338e28eef | ||
|
d4eb53db66 | ||
|
8f777bbc0d | ||
|
7d256b941a | ||
|
c3ceccf9bc | ||
|
c89928824f | ||
|
047f654646 | ||
|
0fc9663aa7 | ||
|
50f623482f | ||
|
2e0f79f8b6 | ||
|
308cb3daf9 | ||
|
f1b3c2fa8b | ||
|
2f6d66af9d | ||
|
ef21b84507 | ||
|
c9dd6721cf | ||
|
428519788b | ||
|
522df62704 | ||
|
d35b677f4b | ||
|
b1c183b83c | ||
|
7555f14f91 | ||
|
bc2a793022 | ||
|
a40e52b504 |
47 changed files with 49395 additions and 11324 deletions
|
@ -187,6 +187,101 @@
|
|||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "V0lantis",
|
||||
"name": "Arthur",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/37664438?v=4",
|
||||
"profile": "https://arthurvolant.com",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "rodrigorfk",
|
||||
"name": "Rodrigo Fior Kuntzer",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1995033?v=4",
|
||||
"profile": "https://github.com/rodrigorfk",
|
||||
"contributions": [
|
||||
"code",
|
||||
"test",
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "levenleven",
|
||||
"name": "Aleksey Levenstein",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/6463364?v=4",
|
||||
"profile": "https://github.com/levenleven",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "dan-hill2802",
|
||||
"name": "Daniel Hill",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5046322?v=4",
|
||||
"profile": "https://github.com/dan-hill2802",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "KeisukeYamashita",
|
||||
"name": "KeisukeYamashita",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/23056537?v=4",
|
||||
"profile": "https://keisukeyamashita.com",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "codesculpture",
|
||||
"name": "Aravind",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/63452117?v=4",
|
||||
"profile": "https://github.com/codesculpture",
|
||||
"contributions": [
|
||||
"code",
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Whadup",
|
||||
"name": "Lukas Pfahler",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/2308119?v=4",
|
||||
"profile": "https://lukaspfahler.de",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "RajendraP",
|
||||
"name": "Rajendra Pandey",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/8928165?v=4",
|
||||
"profile": "https://github.com/RajendraP",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "undefined-moe",
|
||||
"name": "undefined",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/29992205?v=4",
|
||||
"profile": "https://undefined.moe/",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Jellyfrog",
|
||||
"name": "Jellyfrog",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/759887?v=4",
|
||||
"profile": "https://github.com/Jellyfrog",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
@ -195,5 +290,6 @@
|
|||
"repoType": "github",
|
||||
"repoHost": "https://github.com",
|
||||
"skipCi": true,
|
||||
"commitConvention": "angular"
|
||||
"commitConvention": "angular",
|
||||
"commitType": "docs"
|
||||
}
|
||||
|
|
4
.codacy.yml
Normal file
4
.codacy.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
exclude_paths:
|
||||
- "*.md"
|
||||
- "dist/**"
|
12
.github/FUNDING.yml
vendored
12
.github/FUNDING.yml
vendored
|
@ -1,12 +0,0 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: jackton1
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: tj-actions
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: []
|
98
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
98
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
|
@ -1,98 +0,0 @@
|
|||
name: 🐞 Bug
|
||||
description: Create a report to help us improve
|
||||
title: "[BUG] <title>"
|
||||
labels: [bug, needs triage]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Is there an existing issue for this?
|
||||
description: Please search to see if an issue already exists for the bug you encountered.
|
||||
options:
|
||||
- label: I have searched the existing issues
|
||||
required: true
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Does this issue exist in the latest version?
|
||||
description: Please view all releases to confirm that this issue hasn't already been fixed.
|
||||
options:
|
||||
- label: I'm using the latest release
|
||||
required: true
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: Describe the bug?
|
||||
description: A clear and concise description of what the bug is
|
||||
placeholder: Tell us what you see!
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: To Reproduce
|
||||
description: Steps to reproduce the behavior?
|
||||
placeholder: |
|
||||
1. In this environment...
|
||||
2. With this config...
|
||||
3. Run '...'
|
||||
4. See error...
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: What OS are you seeing the problem on?
|
||||
multiple: true
|
||||
options:
|
||||
- all
|
||||
- ubuntu-latest or ubuntu-20.04
|
||||
- ubuntu-18.04
|
||||
- macos-latest or macos-10.15
|
||||
- macos-11
|
||||
- windows-latest or windows-2019
|
||||
- windows-2016
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected behavior?
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
placeholder: Tell us what you expected!
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Please copy and paste any relevant log output which is obtained after enabling debug logging. This will be automatically formatted into code, so no need for backticks.
|
||||
placeholder: |
|
||||
1. Re-running the workflow with debug logging enabled.
|
||||
2. Copy or download the log archive.
|
||||
3. Paste the contents here or upload the file in a subsequent comment.
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything else?
|
||||
description: |
|
||||
Links? or References?
|
||||
|
||||
Anything that will give us more context about the issue you are encountering!
|
||||
|
||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Code of Conduct
|
||||
description: By submitting this issue, you agree to follow our [Code of Conduct](../blob/main/CODE_OF_CONDUCT.md)
|
||||
options:
|
||||
- label: I agree to follow this project's Code of Conduct
|
||||
required: true
|
59
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
59
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
|
@ -1,59 +0,0 @@
|
|||
name: Feature request
|
||||
description: Suggest an idea for this project
|
||||
title: "[Feature] <title>"
|
||||
labels: [enhancement]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this feature request!
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Is this feature missing in the latest version?
|
||||
description: Please upgrade to the latest version to verify that this feature is still missing.
|
||||
options:
|
||||
- label: I'm using the latest release
|
||||
required: true
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: Is your feature request related to a problem? Please describe.
|
||||
description: |
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
placeholder: Tell us what you see!
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: requests
|
||||
attributes:
|
||||
label: Describe the solution you'd like?
|
||||
description: A clear and concise description of what you want to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: alternative
|
||||
attributes:
|
||||
label: Describe alternatives you've considered?
|
||||
description: A clear and concise description of any alternative solutions or features you've considered.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything else?
|
||||
description: |
|
||||
Links? or References?
|
||||
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Code of Conduct
|
||||
description: By submitting this issue, you agree to follow our [Code of Conduct](../blob/main/CODE_OF_CONDUCT.md)
|
||||
options:
|
||||
- label: I agree to follow this project's Code of Conduct
|
||||
required: true
|
33
.github/workflows/auto-approve.yml
vendored
33
.github/workflows/auto-approve.yml
vendored
|
@ -1,33 +0,0 @@
|
|||
name: Auto approve
|
||||
|
||||
on:
|
||||
pull_request_target
|
||||
|
||||
|
||||
jobs:
|
||||
auto-approve:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: hmarr/auto-approve-action@v3
|
||||
if: |
|
||||
(
|
||||
github.event.pull_request.user.login == 'dependabot[bot]' ||
|
||||
github.event.pull_request.user.login == 'dependabot' ||
|
||||
github.event.pull_request.user.login == 'dependabot-preview[bot]' ||
|
||||
github.event.pull_request.user.login == 'dependabot-preview' ||
|
||||
github.event.pull_request.user.login == 'renovate[bot]' ||
|
||||
github.event.pull_request.user.login == 'renovate' ||
|
||||
github.event.pull_request.user.login == 'github-actions[bot]'
|
||||
)
|
||||
&&
|
||||
(
|
||||
github.actor == 'dependabot[bot]' ||
|
||||
github.actor == 'dependabot' ||
|
||||
github.actor == 'dependabot-preview[bot]' ||
|
||||
github.actor == 'dependabot-preview' ||
|
||||
github.actor == 'renovate[bot]' ||
|
||||
github.actor == 'renovate' ||
|
||||
github.actor == 'github-actions[bot]'
|
||||
)
|
||||
with:
|
||||
github-token: ${{ secrets.PAT_TOKEN }}
|
16
.github/workflows/codacy-analysis.yml
vendored
16
.github/workflows/codacy-analysis.yml
vendored
|
@ -17,24 +17,24 @@ on:
|
|||
schedule:
|
||||
- cron: '15 16 * * 2'
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
codacy-security-scan:
|
||||
# Cancel other workflows that are running for the same branch
|
||||
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
name: Codacy Security Scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Checkout the repository to the GitHub Actions runner
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
continue-on-error: true
|
||||
uses: codacy/codacy-analysis-cli-action@v4.3.0
|
||||
uses: codacy/codacy-analysis-cli-action@97bf5df3c09e75f5bcd72695998f96ebd701846e # v4.4.5
|
||||
with:
|
||||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
|
||||
# You can also omit the token and run the tools that support default configurations
|
||||
|
@ -51,6 +51,6 @@ jobs:
|
|||
# Upload the SARIF file generated in the previous step
|
||||
- name: Upload SARIF results file
|
||||
continue-on-error: true
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
uses: github/codeql-action/upload-sarif@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
|
13
.github/workflows/codeql.yml
vendored
13
.github/workflows/codeql.yml
vendored
|
@ -20,6 +20,11 @@ on:
|
|||
schedule:
|
||||
- cron: '44 20 * * 0'
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
|
@ -38,11 +43,11 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
|
@ -56,7 +61,7 @@ jobs:
|
|||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
uses: github/codeql-action/autobuild@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
@ -69,6 +74,6 @@ jobs:
|
|||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
|
13
.github/workflows/greetings.yml
vendored
13
.github/workflows/greetings.yml
vendored
|
@ -1,13 +0,0 @@
|
|||
name: Greetings
|
||||
|
||||
on: [pull_request_target, issues]
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: "Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience."
|
||||
pr-message: "Thanks for implementing a fix, could you ensure that the test covers your changes if applicable."
|
178
.github/workflows/issue-comment-job-example.yml
vendored
Normal file
178
.github/workflows/issue-comment-job-example.yml
vendored
Normal file
|
@ -0,0 +1,178 @@
|
|||
name: Issue Comment Job Example
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
|
||||
jobs:
|
||||
pr_commented:
|
||||
# This job only runs for pull request comments
|
||||
name: PR comment
|
||||
if: ${{ github.event.issue.pull_request }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
echo A comment on PR $NUMBER
|
||||
env:
|
||||
NUMBER: ${{ github.event.issue.number }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
|
||||
- name: Run changed-files with defaults
|
||||
id: changed-files
|
||||
uses: ./
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Run changed-files for old new filenames test rename
|
||||
id: changed-files-all-old-new-renamed-files
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: d1c0ee4
|
||||
sha: 4d04215
|
||||
fetch_depth: 60000
|
||||
include_all_old_new_renamed_files: true
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Check all_old_new_renamed_files output on non windows platform
|
||||
if: "!contains(steps.changed-files-all-old-new-renamed-files.outputs.all_old_new_renamed_files, 'test/test rename 1.txt,test/test rename-1.txt') && runner.os != 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected to include (test/test rename 1.txt,test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files.outputs.all_old_new_renamed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Check all_old_new_renamed_files output on windows platform
|
||||
if: "!contains(steps.changed-files-all-old-new-renamed-files.outputs.all_old_new_renamed_files, 'test\\test rename 1.txt,test\\test rename-1.txt') && runner.os == 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected to not include (test\\test rename 1.txt,test\\test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files.outputs.all_old_new_renamed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Check the renamed_files output on non windows platform
|
||||
if: "!contains(steps.changed-files-all-old-new-renamed-files.outputs.renamed_files, 'test/test rename-1.txt') && runner.os != 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected to include (test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files.outputs.renamed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Check the renamed_files output on windows platform
|
||||
if: "!contains(steps.changed-files-all-old-new-renamed-files.outputs.renamed_files, 'test\\test rename-1.txt') && runner.os == 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected to not include (test\\test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files.outputs.renamed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
|
||||
issue_commented:
|
||||
# This job only runs for issue comments
|
||||
name: Issue comment
|
||||
if: ${{ !github.event.issue.pull_request }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
echo A comment on issue $NUMBER
|
||||
env:
|
||||
NUMBER: ${{ github.event.issue.number }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
|
||||
- name: Run changed-files with defaults
|
||||
id: changed-files
|
||||
uses: ./
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Run changed-files for old new filenames test rename
|
||||
id: changed-files-all-old-new-renamed-files
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: d1c0ee4
|
||||
sha: 4d04215
|
||||
fetch_depth: 60000
|
||||
include_all_old_new_renamed_files: true
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Check all_old_new_renamed_files output on non windows platform
|
||||
if: "!contains(steps.changed-files-all-old-new-renamed-files.outputs.all_old_new_renamed_files, 'test/test rename 1.txt,test/test rename-1.txt') && runner.os != 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected to include (test/test rename 1.txt,test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files.outputs.all_old_new_renamed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Check all_old_new_renamed_files output on windows platform
|
||||
if: "!contains(steps.changed-files-all-old-new-renamed-files.outputs.all_old_new_renamed_files, 'test\\test rename 1.txt,test\\test rename-1.txt') && runner.os == 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected to not include (test\\test rename 1.txt,test\\test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files.outputs.all_old_new_renamed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Check the renamed_files output on non windows platform
|
||||
if: "!contains(steps.changed-files-all-old-new-renamed-files.outputs.renamed_files, 'test/test rename-1.txt') && runner.os != 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected to include (test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files.outputs.renamed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Check the renamed_files output on windows platform
|
||||
if: "!contains(steps.changed-files-all-old-new-renamed-files.outputs.renamed_files, 'test\\test rename-1.txt') && runner.os == 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected to not include (test\\test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files.outputs.renamed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
|
@ -1,9 +1,11 @@
|
|||
name: Manual Test
|
||||
name: Manual Triggered Job Example
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test changed-files
|
||||
|
@ -16,7 +18,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
|
@ -1,4 +1,7 @@
|
|||
name: Matrix Test
|
||||
name: Matrix Example
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
@ -8,37 +11,35 @@ on:
|
|||
|
||||
jobs:
|
||||
changed-files:
|
||||
name: Get changes
|
||||
name: Get changed files
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
matrix: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
with:
|
||||
json: true
|
||||
quotepath: false
|
||||
matrix: true
|
||||
- name: List all changed files
|
||||
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
|
||||
- id: set-matrix
|
||||
run: echo "matrix={\"files\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
matrix-job:
|
||||
name: Run Matrix Job
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files]
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
|
||||
matrix:
|
||||
files: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
|
||||
max-parallel: 4
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Test
|
||||
run: |
|
||||
echo ${{ matrix.files }}
|
67
.github/workflows/multi-job-example.yml
vendored
Normal file
67
.github/workflows/multi-job-example.yml
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
name: Multi Job Example
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
changed-files:
|
||||
name: Get changed files
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
- name: List all changed files
|
||||
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
|
||||
|
||||
view-changed-files:
|
||||
name: View all changed files
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files]
|
||||
steps:
|
||||
- name: List all changed files
|
||||
run: |
|
||||
echo '${{ needs.changed-files.outputs.all_changed_files }}'
|
||||
|
||||
|
||||
changed-files-rest-api:
|
||||
name: Get changed files using REST API
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
continue-on-error: ${{ github.event_name == 'push' }}
|
||||
uses: ./
|
||||
with:
|
||||
use_rest_api: true
|
||||
- name: List all changed files
|
||||
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
|
||||
|
||||
view-changed-files-rest-api:
|
||||
name: View all changed files using REST API
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files-rest-api]
|
||||
steps:
|
||||
- name: List all changed files
|
||||
run: |
|
||||
echo '${{ needs.changed-files-rest-api.outputs.all_changed_files }}'
|
29
.github/workflows/sync-release-version.yml
vendored
29
.github/workflows/sync-release-version.yml
vendored
|
@ -1,4 +1,9 @@
|
|||
name: Update release version.
|
||||
name: Update release version
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
@ -8,28 +13,38 @@ jobs:
|
|||
update-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Run release-tagger
|
||||
uses: tj-actions/release-tagger@v4
|
||||
uses: tj-actions/release-tagger@1a9264b0fd99a1ef92c4fd2f077f292900cc79b6 # v4.0.0
|
||||
- name: Sync release version.
|
||||
uses: tj-actions/sync-release-version@v13
|
||||
uses: tj-actions/sync-release-version@2a7ef0deb39b3ecce887ee99d2261c6cef989d84 # v13.16
|
||||
id: sync-release-version
|
||||
with:
|
||||
pattern: '${{ github.repository }}@'
|
||||
only_major: true
|
||||
use_tag_commit_hash: true
|
||||
paths: |
|
||||
README.md
|
||||
- name: Sync release package version.
|
||||
uses: tj-actions/sync-release-version@2a7ef0deb39b3ecce887ee99d2261c6cef989d84 # v13.16
|
||||
id: sync-release-package-version
|
||||
with:
|
||||
pattern: '"version": "'
|
||||
strip_prefix: "v"
|
||||
paths: |
|
||||
package.json
|
||||
- name: Run git-cliff
|
||||
uses: tj-actions/git-cliff@v1
|
||||
uses: tj-actions/git-cliff@75599f745633e29f99bd9e14a30865b7d2fcbe84 # v1.5.0
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5.0.2
|
||||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
|
||||
with:
|
||||
base: "main"
|
||||
labels: "merge when passing"
|
||||
sign-commits: true
|
||||
title: "Upgraded to ${{ steps.sync-release-version.outputs.new_version }}"
|
||||
branch: "upgrade-to-${{ steps.sync-release-version.outputs.new_version }}"
|
||||
commit-message: "Upgraded from ${{ steps.sync-release-version.outputs.old_version }} -> ${{ steps.sync-release-version.outputs.new_version }}"
|
||||
body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/${{ steps.sync-release-version.outputs.old_version }}...${{ steps.sync-release-version.outputs.new_version }})"
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
554
.github/workflows/test.yml
vendored
554
.github/workflows/test.yml
vendored
|
@ -1,12 +1,12 @@
|
|||
name: CI
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
pull_request_review:
|
||||
types: [edited, dismissed, submitted]
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
types:
|
||||
- assigned
|
||||
|
@ -27,36 +27,28 @@ on:
|
|||
- auto_merge_enabled
|
||||
- auto_merge_disabled
|
||||
branches:
|
||||
- main
|
||||
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
shellcheck:
|
||||
name: Run shellcheck
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
- name: shellcheck
|
||||
uses: reviewdog/action-shellcheck@v1.18
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
files_changed: ${{ steps.changed_files.outputs.files_changed }}
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
- name: Use Node.js 16.x
|
||||
uses: actions/setup-node@v3.8.1
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
cache: 'yarn'
|
||||
node-version: '16.x'
|
||||
node-version: '20.x'
|
||||
|
||||
- name: Create coverage directory and clover.xml
|
||||
run: |
|
||||
|
@ -68,49 +60,41 @@ jobs:
|
|||
yarn install
|
||||
|
||||
- name: Run eslint on changed files
|
||||
uses: tj-actions/eslint-changed-files@v20
|
||||
uses: tj-actions/eslint-changed-files@0cfcd35949a961d13e964a7c2a4971c0e89b68fc # v25.3.1
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
config_path: ".eslintrc.json"
|
||||
ignore_path: ".eslintignore"
|
||||
|
||||
- name: Run build and test
|
||||
run: |
|
||||
yarn all
|
||||
env:
|
||||
GITHUB_EVENT_PULL_REQUEST_HEAD_REPO_FORK: ${{ github.event.pull_request.head.repo.fork }}
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v16
|
||||
id: changed_files
|
||||
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20.0.4
|
||||
if: github.actor != 'dependabot[bot]'
|
||||
id: verify_changed_files
|
||||
with:
|
||||
files: |
|
||||
src
|
||||
dist
|
||||
|
||||
- name: Commit files
|
||||
if: steps.changed_files.outputs.files_changed == 'true' && github.event_name == 'pull_request'
|
||||
- name: Verify outstanding changes
|
||||
if: steps.verify_changed_files.outputs.files_changed == 'true' && github.event_name == 'pull_request'
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add src dist
|
||||
git commit -m "Added missing changes and modified dist assets."
|
||||
|
||||
- name: Push changes
|
||||
if: steps.changed_files.outputs.files_changed == 'true' && github.event_name == 'pull_request'
|
||||
continue-on-error: true
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.PAT_TOKEN }}
|
||||
branch: ${{ github.head_ref }}
|
||||
echo "Uncommitted build/lint changes detected. Please run 'yarn all' locally and push the changes for review."
|
||||
exit 1
|
||||
|
||||
- name: Upload build assets
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: build-assets
|
||||
path: dist
|
||||
|
||||
- name: Run codacy-coverage-reporter
|
||||
uses: codacy/codacy-coverage-reporter-action@v1
|
||||
uses: codacy/codacy-coverage-reporter-action@89d6c85cfafaec52c72b6c5e8b2878d33104c699 # v1.3.0
|
||||
continue-on-error: true
|
||||
with:
|
||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
|
@ -121,9 +105,11 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout into dir1
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
|
@ -131,7 +117,7 @@ jobs:
|
|||
path: dir1
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
path: dir1/dist
|
||||
|
@ -157,13 +143,13 @@ jobs:
|
|||
bash
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
path: dir2/dist
|
||||
|
||||
- name: Checkout into dir2
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
|
@ -195,16 +181,17 @@ jobs:
|
|||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && needs.build.outputs.files_changed != 'true'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -253,16 +240,18 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -286,30 +275,35 @@ jobs:
|
|||
shell:
|
||||
bash
|
||||
|
||||
test-unset-github-output-env:
|
||||
name: Test unset GITHUB_OUTPUT env
|
||||
test-using-branch-names-for-base-sha-and-sha-inputs:
|
||||
name: Test using branch names for base_sha and sha inputs
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
if: |
|
||||
(
|
||||
github.event_name == 'push' ||
|
||||
github.event_name == 'pull_request'
|
||||
) && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files with unset GITHUB_OUTPUT env
|
||||
- name: Run changed-files with main as the base_sha
|
||||
id: changed-files
|
||||
continue-on-error: true
|
||||
uses: ./
|
||||
env:
|
||||
GITHUB_OUTPUT: ""
|
||||
with:
|
||||
base_sha: main
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
|
@ -322,6 +316,8 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -332,13 +328,13 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -361,15 +357,17 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -388,6 +386,8 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
|
@ -396,14 +396,14 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
persist-credentials: false
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -422,13 +422,14 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -476,13 +477,14 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -534,7 +536,7 @@ jobs:
|
|||
pull-requests: read
|
||||
steps:
|
||||
- name: Checkout into dir1
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
|
@ -542,7 +544,7 @@ jobs:
|
|||
path: dir1
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
path: dir1/dist
|
||||
|
@ -557,11 +559,83 @@ jobs:
|
|||
shell:
|
||||
bash
|
||||
|
||||
test-dir-names-nested-folder:
|
||||
name: Test changed-files with dir-names in a nested folder
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
path: dist
|
||||
|
||||
- name: Get changed files in the .github folder
|
||||
id: changed-files
|
||||
uses: ./
|
||||
with:
|
||||
path: .github
|
||||
json: true
|
||||
escape_json: false
|
||||
dir_names: true
|
||||
dir_names_exclude_current_dir: true
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
test-non-existing-repository:
|
||||
name: Test changed-files with non existing repository
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name == 'push' && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout into dir1
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
path: dir1
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
path: dir1/dist
|
||||
|
||||
- name: Run changed-files with non existing repository
|
||||
id: changed-files
|
||||
continue-on-error: true
|
||||
uses: ./dir1
|
||||
|
||||
- name: Verify failed
|
||||
if: steps.changed-files.outcome != 'failure'
|
||||
run: |
|
||||
echo "Expected: (failure) got ${{ steps.changed-files.outcome }}"
|
||||
exit 1
|
||||
|
||||
test-submodules:
|
||||
name: Test changed-files with submodule
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
|
@ -570,14 +644,14 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
submodules: recursive
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -600,11 +674,34 @@ jobs:
|
|||
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Run changed-files excluding submodule
|
||||
id: changed-files-exclude-submodule
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: "85bd869"
|
||||
sha: "adde7bb"
|
||||
fetch_depth: 60000
|
||||
exclude_submodules: true
|
||||
|
||||
- name: Verify no added files
|
||||
if: steps.changed-files-exclude-submodule.outputs.added_files != ''
|
||||
run: |
|
||||
echo "Expected: ('') got ${{ steps.changed-files-exclude-submodule.outputs.added_files }}"
|
||||
exit 1
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-exclude-submodule.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
test-yaml:
|
||||
name: Test changed-files with yaml
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
|
@ -613,14 +710,14 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
submodules: recursive
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -652,11 +749,54 @@ jobs:
|
|||
shell:
|
||||
bash
|
||||
|
||||
- name: Run changed-files with files_yaml, files_ignore_yaml
|
||||
id: changed-files-ignore
|
||||
uses: ./
|
||||
with:
|
||||
files_yaml: |
|
||||
test:
|
||||
- test/**.txt
|
||||
- test/**.md
|
||||
files_ignore_yaml: |
|
||||
test:
|
||||
- test/test.txt
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-ignore.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Run changed-files with files_yaml, json and write_output_files
|
||||
id: changed-files-json-write-output-files
|
||||
uses: ./
|
||||
with:
|
||||
files_yaml: |
|
||||
test:
|
||||
- .github/workflows/test.yml
|
||||
json: true
|
||||
write_output_files: true
|
||||
|
||||
- name: Show all outputs
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-json-write-output-files.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Show all_changed_files output and list .github/outputs
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-json-write-output-files.outputs.test_all_changed_files) }}'
|
||||
cat .github/outputs/test_all_changed_files.json
|
||||
shell:
|
||||
bash
|
||||
|
||||
test-recover-deleted-file:
|
||||
name: Test changed-files recover deleted file
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
|
@ -665,14 +805,14 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
submodules: recursive
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
|
@ -714,7 +854,7 @@ jobs:
|
|||
base_sha: "fcdeb5b3d797752d95f6dbe98552a95c29dad338"
|
||||
sha: "432e0c810c60ef1332850a971c5ec39022034b4c"
|
||||
files: |
|
||||
test
|
||||
test/**
|
||||
recover_deleted_files: true
|
||||
fetch_depth: 60000
|
||||
|
||||
|
@ -765,6 +905,12 @@ jobs:
|
|||
echo "Expected: (test/test deleted.txt) got ${{ steps.changed-files-recover-deleted-files-with-files-yaml.outputs.test_deleted_files }}"
|
||||
exit 1
|
||||
|
||||
- name: Verify that the modified_keys is correct
|
||||
if: "!contains(steps.changed-files-recover-deleted-files-with-files-yaml.outputs.modified_keys, 'test')"
|
||||
run: |
|
||||
echo "Expected: (test) got ${{ steps.changed-files-recover-deleted-files-with-files-yaml.outputs.modified_keys }}"
|
||||
exit 1
|
||||
|
||||
- name: Verify that test/test deleted.txt is restored
|
||||
run: |
|
||||
if [ ! -f "test/test deleted.txt" ]; then
|
||||
|
@ -806,11 +952,206 @@ jobs:
|
|||
cat "deleted_files/test/test deleted.txt"
|
||||
fi
|
||||
|
||||
- name: Run changed-files with recover_deleted_files for an expected git submodule file
|
||||
id: changed-files-recover-deleted-files-within-submodule
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: "3be651e99d3d4eae395694f6c6f3b9d18457f6c8"
|
||||
sha: "d90c240f2ad4ec04d8f0f48e5ac290ad96ebe850"
|
||||
recover_deleted_files: true
|
||||
fetch_depth: 60000
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-recover-deleted-files-within-submodule.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Verify deleted files
|
||||
if: steps.changed-files-recover-deleted-files-within-submodule.outputs.deleted_files != 'test/demo/.github/FUNDING.yml'
|
||||
run: |
|
||||
echo "Expected: (test/demo/.github/FUNDING.yml) got ${{ steps.changed-files-recover-deleted-files-within-submodule.outputs.deleted_files }}"
|
||||
exit 1
|
||||
- name: Verify that test/demo/.github/FUNDING.yml is restored
|
||||
run: |
|
||||
if [ ! -f "test/demo/.github/FUNDING.yml" ]; then
|
||||
echo "Expected: (test/demo/.github/FUNDING.yml) to exist"
|
||||
exit 1
|
||||
else
|
||||
cat "test/demo/.github/FUNDING.yml"
|
||||
rm "test/demo/.github/FUNDING.yml"
|
||||
fi
|
||||
|
||||
test-dir-names-deleted-files-include-only-deleted-dirs-single-file:
|
||||
name: Test dir names deleted files include only deleted dirs single file
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: a52f8621d26d5d9f54b80f74bda2d9eedff94693
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
fetch-depth: 2
|
||||
- name: Run changed-files with dir_names and dir_names_deleted_files_include_only_deleted_dirs with a single file deleted withing the test directory
|
||||
id: changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: 920856cfdd4b4be17810e34b197596397473adf6
|
||||
sha: a52f8621d26d5d9f54b80f74bda2d9eedff94693
|
||||
dir_names: true
|
||||
dir_names_deleted_files_include_only_deleted_dirs: true
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Check deleted_files output
|
||||
if: steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs.deleted_files != ''
|
||||
run: |
|
||||
echo "Invalid output: Expected '' got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs.deleted_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
test-dir-names-deleted-files-include-only-deleted-dirs-directory:
|
||||
name: Test dir names deleted files include only deleted dirs
|
||||
runs-on: ${{ matrix.platform }}
|
||||
needs: build
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
fetch-depth: 2
|
||||
- name: Run changed-files with dir_names and dir_names_deleted_files_include_only_deleted_dirs with the test directory deleted
|
||||
id: changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: a52f8621d26d5d9f54b80f74bda2d9eedff94693
|
||||
sha: cd1e384723e4d1a184568182ac2b27c53ebf017f
|
||||
dir_names: true
|
||||
dir_names_deleted_files_include_only_deleted_dirs: true
|
||||
fetch_depth: 60000
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Check deleted_files output on non windows platform
|
||||
if: steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files != 'test/test3' && runner.os != 'Windows'
|
||||
run: |
|
||||
echo "Invalid output: Expected (test/test3) got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Check deleted_files output on windows platform
|
||||
if: "!contains(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files, 'test\\test3') && runner.os == 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected (test\\test3) got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with dir_names and dir_names_deleted_files_include_only_deleted_dirs with the test directory deleted returns posix path separator
|
||||
id: changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory-posix-path-separator
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: a52f8621d26d5d9f54b80f74bda2d9eedff94693
|
||||
sha: cd1e384723e4d1a184568182ac2b27c53ebf017f
|
||||
dir_names: true
|
||||
dir_names_deleted_files_include_only_deleted_dirs: true
|
||||
use_posix_path_separator: true
|
||||
fetch_depth: 60000
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory-posix-path-separator.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Check deleted_files output on non windows platform
|
||||
if: steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory-posix-path-separator.outputs.deleted_files != 'test/test3' && runner.os != 'Windows'
|
||||
run: |
|
||||
echo "Invalid output: Expected (test/test3) got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory-posix-path-separator.outputs.deleted_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Check deleted_files output on windows platform
|
||||
if: "!contains(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory-posix-path-separator.outputs.deleted_files, 'test/test3') && runner.os == 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected (test/test3) got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory-posix-path-separator.outputs.deleted_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
|
||||
test-since-last-remote-commit:
|
||||
name: Test changed-files since last remote commit
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
fetch-depth: [0, 1, 2]
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
submodules: true
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files with since_last_remote_commit
|
||||
id: changed-files-since-last-remote-commit
|
||||
continue-on-error: true
|
||||
uses: ./
|
||||
with:
|
||||
since_last_remote_commit: true
|
||||
|
||||
- name: Verify succeeded pull_request(closed)
|
||||
if: steps.changed-files-since-last-remote-commit.outcome != 'success' && matrix.fetch-depth == 1 && github.event.action == 'closed' && github.event_name == 'pull_request'
|
||||
run: |
|
||||
echo "Expected: (success) got ${{ steps.changed-files-since-last-remote-commit.outcome }}"
|
||||
exit 1
|
||||
|
||||
- name: Verify succeeded
|
||||
if: steps.changed-files-since-last-remote-commit.outcome != 'success' && matrix.fetch-depth != 1
|
||||
run: |
|
||||
echo "Expected: (success) got ${{ steps.changed-files-since-last-remote-commit.outcome }}"
|
||||
exit 1
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-since-last-remote-commit.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
test:
|
||||
name: Test changed-files
|
||||
runs-on: ${{ matrix.platform }}
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
|
@ -820,13 +1161,13 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
submodules: true
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-assets
|
||||
- name: Dump GitHub context
|
||||
|
@ -841,17 +1182,7 @@ jobs:
|
|||
echo '${{ toJSON(steps.changed-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with since_last_remote_commit
|
||||
id: changed-files-since-last-remote-commit
|
||||
uses: ./
|
||||
with:
|
||||
since_last_remote_commit: true
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-since-last-remote-commit.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with dir name
|
||||
- name: Run changed-files with dir name pattern
|
||||
id: changed-files-dir-name
|
||||
uses: ./
|
||||
with:
|
||||
|
@ -1029,7 +1360,8 @@ jobs:
|
|||
if: |
|
||||
(
|
||||
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test/test rename-1.txt') ||
|
||||
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test')
|
||||
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test') ||
|
||||
steps.changed-files-dir-names-specific-include-files.outputs.any_changed == 'false'
|
||||
) && runner.os != 'Windows'
|
||||
run: |
|
||||
echo "Invalid output: Expected to include (test/test rename-1.txt) and (test) got (${{ steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files }})"
|
||||
|
@ -1040,13 +1372,41 @@ jobs:
|
|||
if: |
|
||||
(
|
||||
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test\\test rename-1.txt') ||
|
||||
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test')
|
||||
!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test') ||
|
||||
steps.changed-files-dir-names-specific-include-files.outputs.any_changed == 'false'
|
||||
) && runner.os == 'Windows'
|
||||
run: |
|
||||
echo "Invalid output: Expected to include (test\\test rename-1.txt) and (test) got (${{ steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with dir_names for specific files and an unmatched path
|
||||
id: changed-files-dir-names-specific-unmatched-path
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: d1c0ee4
|
||||
sha: 4d04215
|
||||
fetch_depth: 60000
|
||||
dir_names: true
|
||||
files: unknown/**
|
||||
json: true
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir-names-specific-unmatched-path.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Check dir_names output
|
||||
if: |
|
||||
(
|
||||
steps.changed-files-dir-names-specific-unmatched-path.outputs.all_changed_files != '[]' ||
|
||||
steps.changed-files-dir-names-specific-unmatched-path.outputs.any_changed == 'true' ||
|
||||
steps.changed-files-dir-names-specific-unmatched-path.outputs.all_changed_files_count != '0'
|
||||
)
|
||||
run: |
|
||||
echo "Invalid output: Expected empty array and any_changed to be false got (${{ steps.changed-files-dir-names-specific-unmatched-path.outputs.all_changed_files }}) and (${{ steps.changed-files-dir-names-specific-unmatched-path.outputs.any_changed }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with forward slash separator
|
||||
id: changed-files-forward-slash
|
||||
uses: ./
|
||||
|
@ -1348,14 +1708,14 @@ jobs:
|
|||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Check if a excluded file is not included in any_deleted on non windows platform
|
||||
- name: Check if an excluded file is included in deleted_files output on non windows platform
|
||||
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/test/test.txt') && runner.os != 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Check if a excluded file is not included in any_deleted on windows platform
|
||||
- name: Check if an excluded file is included in deleted_files output on windows platform
|
||||
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test\\test\\test.txt') && runner.os == 'Windows'"
|
||||
run: |
|
||||
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"
|
||||
|
@ -1792,9 +2152,9 @@ jobs:
|
|||
bash
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v7
|
||||
uses: tj-actions/branch-names@dde14ac574a8b9b1cedc59a1cf312788af43d8d8 # v8.2.1
|
||||
if: github.event_name == 'pull_request' && matrix.fetch-depth == 0
|
||||
- uses: nrwl/nx-set-shas@v3
|
||||
- uses: nrwl/nx-set-shas@dbe0650947e5f2c81f59190a38512cf49126fe6b # v4.3.0
|
||||
id: last_successful_commit
|
||||
if: github.event_name == 'pull_request' && github.event.action != 'closed' && matrix.fetch-depth == 0
|
||||
with:
|
||||
|
|
21
.github/workflows/update-readme.yml
vendored
21
.github/workflows/update-readme.yml
vendored
|
@ -1,5 +1,9 @@
|
|||
name: Format README.md
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
|
@ -9,18 +13,22 @@ jobs:
|
|||
sync-assets:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run auto-doc
|
||||
uses: tj-actions/auto-doc@v3
|
||||
uses: tj-actions/auto-doc@b10ceedffd794ec29a8fa8700529f40c1b64a951 # v3.6.0
|
||||
with:
|
||||
use_code_blocks: true
|
||||
use_major_version: true
|
||||
use_tag_commit_hash: true
|
||||
|
||||
- name: Run remark
|
||||
uses: tj-actions/remark@v3
|
||||
uses: tj-actions/remark@10fc40701928cbafcc4a2d241679579d218144ff # v3
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v16
|
||||
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20.0.4
|
||||
id: verify_changed_files
|
||||
with:
|
||||
files: |
|
||||
|
@ -34,7 +42,7 @@ jobs:
|
|||
|
||||
- name: Create Pull Request
|
||||
if: failure()
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
|
||||
with:
|
||||
base: "main"
|
||||
labels: "merge when passing"
|
||||
|
@ -42,4 +50,5 @@ jobs:
|
|||
branch: "chore/update-readme"
|
||||
commit-message: "Updated README.md"
|
||||
body: "Updated README.md"
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
sign-commits: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
41
.github/workflows/workflow-run-example.yml
vendored
Normal file
41
.github/workflows/workflow-run-example.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
name: Workflow Run Example
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Matrix Example]
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
on-success:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
|
||||
- name: Echo list of changed files on success
|
||||
run: |
|
||||
echo "Changed files on success:"
|
||||
echo "${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
|
||||
on-failure:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
|
||||
- name: Echo list of changed files on failure
|
||||
run: |
|
||||
echo "Changed files on failure:"
|
||||
echo "${{ steps.changed-files.outputs.all_changed_files }}"
|
2
.nvmrc
2
.nvmrc
|
@ -1 +1 @@
|
|||
16
|
||||
20
|
||||
|
|
2682
HISTORY.md
2682
HISTORY.md
File diff suppressed because it is too large
Load diff
32
SECURITY.md
Normal file
32
SECURITY.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Security Policy
|
||||
|
||||
## Proactive Security Measures
|
||||
|
||||
To proactively detect and address security vulnerabilities, we utilize several robust tools and processes:
|
||||
|
||||
- **Dependency Updates:** We use [Renovate](https://renovatebot.com) and [Dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates) to keep our dependencies updated and promptly patch detected vulnerabilities through automated PRs.
|
||||
- **[GitHub's Security Features](https://github.com/features/security):** Our repository and dependencies are continuously monitored via GitHub's security features, which include:
|
||||
- **Code Scanning:** Using GitHub's CodeQL, all pull requests are scanned to identify potential vulnerabilities in our source code.
|
||||
- **Automated Alerts:** Dependabot identifies vulnerabilities based on the GitHub Advisory Database and opens PRs with patches, while automated [secret scanning](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-partner-patterns) provides alerts for detected secrets.
|
||||
- **[GitGuardian Security Checks](https://www.gitguardian.com/):** We employ GitGuardian to ensure security checks are performed on the codebase, enhancing the overall security of our project.
|
||||
- **Code Analysis and Security Scanning:** With the help of [Codacy Static Code Analysis](https://www.codacy.com/) and [Codacy Security Scan](https://security.codacy.com/), we conduct thorough analyses and scans of our code for potential security risks.
|
||||
|
||||
## Reporting Security Vulnerabilities
|
||||
|
||||
Despite our best efforts to deliver secure software, we acknowledge the invaluable role of the community in identifying security breaches.
|
||||
|
||||
### Private Vulnerability Disclosures
|
||||
|
||||
We request all suspected vulnerabilities to be responsibly and privately disclosed by sending an email to [support@tj-actions.online](mailto:support@tj-actions.online).
|
||||
|
||||
### Public Vulnerability Disclosures
|
||||
|
||||
For publicly disclosed security vulnerabilities, please **IMMEDIATELY** email [support@tj-actions.online](mailto:support@tj-actions.online) with the details for prompt action.
|
||||
|
||||
Upon confirmation of a breach, reporters will receive full credit and recognition for their contribution. Please note, that we do not offer monetary compensation for reporting vulnerabilities.
|
||||
|
||||
## Communication of Security Breaches
|
||||
|
||||
We will utilize the [GitHub Security Advisory](https://github.com/tj-actions/changed-files/security/advisories) to communicate any security breaches. The advisory will be made public once a patch has been released to rectify the issue.
|
||||
|
||||
We appreciate your cooperation and contribution to maintaining the security of our software. Remember, a secure community is a strong community.
|
130
action.yml
130
action.yml
|
@ -4,11 +4,11 @@ author: tj-actions
|
|||
|
||||
inputs:
|
||||
separator:
|
||||
description: "Split character for output strings"
|
||||
description: "Split character for output strings."
|
||||
required: false
|
||||
default: " "
|
||||
include_all_old_new_renamed_files:
|
||||
description: "Include `all_old_new_renamed_files` output. Note this can generate a large output See: [#501](https://github.com/tj-actions/changed-files/issues/501)."
|
||||
description: "Include `all_old_new_renamed_files` output. Note this can generate a large output See: #501."
|
||||
required: false
|
||||
default: "false"
|
||||
old_new_separator:
|
||||
|
@ -24,11 +24,13 @@ inputs:
|
|||
required: false
|
||||
default: ""
|
||||
files_from_source_file_separator:
|
||||
description: 'Separator used to split the `files_from_source_file` input'
|
||||
description: "Separator used to split the `files_from_source_file` input."
|
||||
default: "\n"
|
||||
required: false
|
||||
files:
|
||||
description: "File and directory patterns used to detect changes (Defaults to the entire repo if unset) **NOTE:** Multiline file/directory patterns should not include quotes."
|
||||
description: |
|
||||
File and directory patterns used to detect changes (Defaults to the entire repo if unset).
|
||||
NOTE: Multiline file/directory patterns should not include quotes.
|
||||
required: false
|
||||
default: ""
|
||||
files_separator:
|
||||
|
@ -40,7 +42,7 @@ inputs:
|
|||
required: false
|
||||
default: ""
|
||||
files_yaml_from_source_file:
|
||||
description: "Source file(s) used to populate the `files_yaml` input. [Example](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml)"
|
||||
description: "Source file(s) used to populate the `files_yaml` input. Example: https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml"
|
||||
required: false
|
||||
default: ""
|
||||
files_yaml_from_source_file_separator:
|
||||
|
@ -52,7 +54,7 @@ inputs:
|
|||
required: false
|
||||
default: ""
|
||||
files_ignore_yaml_from_source_file:
|
||||
description: "Source file(s) used to populate the `files_ignore_yaml` input. [Example](https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml)"
|
||||
description: "Source file(s) used to populate the `files_ignore_yaml` input. Example: https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml"
|
||||
required: false
|
||||
default: ""
|
||||
files_ignore_yaml_from_source_file_separator:
|
||||
|
@ -60,7 +62,7 @@ inputs:
|
|||
default: "\n"
|
||||
required: false
|
||||
files_ignore:
|
||||
description: "Ignore changes to these file(s) **NOTE:** Multiline file/directory patterns should not include quotes."
|
||||
description: "Ignore changes to these file(s). NOTE: Multiline file/directory patterns should not include quotes."
|
||||
required: false
|
||||
default: ""
|
||||
files_ignore_separator:
|
||||
|
@ -76,10 +78,10 @@ inputs:
|
|||
default: "\n"
|
||||
required: false
|
||||
sha:
|
||||
description: "Specify a different commit SHA used for comparing changes"
|
||||
description: "Specify a different commit SHA or branch used for comparing changes"
|
||||
required: false
|
||||
base_sha:
|
||||
description: "Specify a different base commit SHA used for comparing changes"
|
||||
description: "Specify a different base commit SHA or branch used for comparing changes"
|
||||
required: false
|
||||
since:
|
||||
description: "Get changed files for commits whose timestamp is older than the given time."
|
||||
|
@ -94,16 +96,16 @@ inputs:
|
|||
required: false
|
||||
default: "."
|
||||
quotepath:
|
||||
description: "Use non-ascii characters to match files and output the filenames completely verbatim by setting this to `false`"
|
||||
description: "Use non-ASCII characters to match files and output the filenames completely verbatim by setting this to `false`"
|
||||
default: "true"
|
||||
required: false
|
||||
diff_relative:
|
||||
description: "Exclude changes outside the current directory and show path names relative to it. **NOTE:** This requires you to specify the top level directory via the `path` input."
|
||||
description: "Exclude changes outside the current directory and show path names relative to it. NOTE: This requires you to specify the top-level directory via the `path` input."
|
||||
required: false
|
||||
default: "true"
|
||||
dir_names:
|
||||
default: "false"
|
||||
description: "Output unique changed directories instead of filenames. **NOTE:** This returns `.` for changed files located in the current working directory which defaults to `$GITHUB_WORKSPACE`."
|
||||
description: "Output unique changed directories instead of filenames. NOTE: This returns `.` for changed files located in the current working directory which defaults to `$GITHUB_WORKSPACE`."
|
||||
required: false
|
||||
dir_names_max_depth:
|
||||
description: "Limit the directory output to a maximum depth e.g `test/test1/test2` with max depth of `2` returns `test/test1`."
|
||||
|
@ -113,27 +115,37 @@ inputs:
|
|||
required: false
|
||||
default: "false"
|
||||
dir_names_include_files:
|
||||
description: "Include files in the output when `dir_names` is set to `true`. **NOTE:** This returns only the matching files and also the directory names."
|
||||
description: "File and directory patterns to include in the output when `dir_names` is set to `true`. NOTE: This returns only the matching files and also the directory names."
|
||||
required: false
|
||||
default: ""
|
||||
dir_names_include_files_separator:
|
||||
description: "Separator used to split the `dir_names_include_files` input"
|
||||
default: "\n"
|
||||
required: false
|
||||
dir_names_deleted_files_include_only_deleted_dirs:
|
||||
description: "Include only directories that have been deleted as opposed to directory names of files that have been deleted in the `deleted_files` output when `dir_names` is set to `true`."
|
||||
required: false
|
||||
default: "false"
|
||||
json:
|
||||
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs."
|
||||
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs. Example: https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-example.yml"
|
||||
required: false
|
||||
default: "false"
|
||||
escape_json:
|
||||
description: "Escape JSON output."
|
||||
required: false
|
||||
default: "true"
|
||||
fetch_depth:
|
||||
description: "Depth of additional branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history."
|
||||
safe_output:
|
||||
description: "Apply sanitization to output filenames before being set as output."
|
||||
required: false
|
||||
default: "50"
|
||||
default: "true"
|
||||
fetch_depth:
|
||||
description: "Depth of additional branch history fetched. NOTE: This can be adjusted to resolve errors with insufficient history."
|
||||
required: false
|
||||
default: "25"
|
||||
skip_initial_fetch:
|
||||
description: "Skip the initial fetch to improve performance for shallow repositories. **NOTE**: This could lead to errors with missing history and the intended use is limited to when you've fetched the history necessary to perform the diff."
|
||||
description: |
|
||||
Skip initially fetching additional history to improve performance for shallow repositories.
|
||||
NOTE: This could lead to errors with missing history. It's intended to be used when you've fetched all necessary history to perform the diff.
|
||||
required: false
|
||||
default: "false"
|
||||
fetch_additional_submodule_history:
|
||||
|
@ -145,7 +157,7 @@ inputs:
|
|||
required: false
|
||||
default: "false"
|
||||
write_output_files:
|
||||
description: "Write outputs to the `output_dir` defaults to `.github/outputs` folder. **NOTE:** This creates a `.txt` file by default and a `.json` file if `json` is set to `true`."
|
||||
description: "Write outputs to the `output_dir` defaults to `.github/outputs` folder. NOTE: This creates a `.txt` file by default and a `.json` file if `json` is set to `true`."
|
||||
required: false
|
||||
default: "false"
|
||||
output_dir:
|
||||
|
@ -165,7 +177,10 @@ inputs:
|
|||
required: false
|
||||
default: ""
|
||||
recover_files:
|
||||
description: "File and directory patterns used to recover deleted files, defaults to the patterns provided via the `files`, `files_from_source_file`, `files_ignore` and `files_ignore_from_source_file` inputs or all deleted files if no patterns are provided."
|
||||
description: |
|
||||
File and directory patterns used to recover deleted files,
|
||||
defaults to the patterns provided via the `files`, `files_from_source_file`, `files_ignore` and `files_ignore_from_source_file` inputs
|
||||
or all deleted files if no patterns are provided.
|
||||
required: false
|
||||
default: ""
|
||||
recover_files_separator:
|
||||
|
@ -181,19 +196,62 @@ inputs:
|
|||
default: "\n"
|
||||
required: false
|
||||
token:
|
||||
description: "Github token used to fetch changed files from Github's API."
|
||||
description: "GitHub token used to fetch changed files from Github's API."
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
api_url:
|
||||
description: "Github API URL."
|
||||
required: false
|
||||
default: ${{ github.api_url }}
|
||||
use_rest_api:
|
||||
description: "Force the use of Github's REST API even when a local copy of the repository exists"
|
||||
required: false
|
||||
default: "false"
|
||||
fail_on_initial_diff_error:
|
||||
description: "Fail when the initial diff fails."
|
||||
required: false
|
||||
default: "false"
|
||||
fail_on_submodule_diff_error:
|
||||
description: "Fail when the submodule diff fails."
|
||||
required: false
|
||||
default: "false"
|
||||
negation_patterns_first:
|
||||
description: "Apply the negation patterns first. NOTE: This affects how changed files are matched."
|
||||
required: false
|
||||
default: "false"
|
||||
matrix:
|
||||
description: "Output changed files in a format that can be used for matrix jobs. Alias for setting inputs `json` to `true` and `escape_json` to `false`."
|
||||
required: false
|
||||
default: "false"
|
||||
exclude_submodules:
|
||||
description: "Exclude changes to submodules."
|
||||
required: false
|
||||
default: "false"
|
||||
fetch_missing_history_max_retries:
|
||||
description: "Maximum number of retries to fetch missing history."
|
||||
required: false
|
||||
default: "20"
|
||||
use_posix_path_separator:
|
||||
description: "Use POSIX path separator `/` for output file paths on Windows."
|
||||
required: false
|
||||
default: "false"
|
||||
tags_pattern:
|
||||
description: "Tags pattern to include."
|
||||
required: false
|
||||
default: "*"
|
||||
tags_ignore_pattern:
|
||||
description: "Tags pattern to ignore."
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
|
||||
outputs:
|
||||
added_files:
|
||||
description: "Returns only files that are Added (A)."
|
||||
added_files_count:
|
||||
description: "Returns the number of `added_files`"
|
||||
any_added:
|
||||
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs have been added."
|
||||
copied_files:
|
||||
description: "Returns only files that are Copied (C)."
|
||||
copied_files_count:
|
||||
|
@ -227,44 +285,48 @@ outputs:
|
|||
unknown_files_count:
|
||||
description: "Returns the number of `unknown_files`"
|
||||
all_changed_and_modified_files:
|
||||
description: "Returns all changed and modified files i.e. *a combination of (ACMRDTUX)*"
|
||||
description: "Returns all changed and modified files i.e. a combination of (ACMRDTUX)"
|
||||
all_changed_and_modified_files_count:
|
||||
description: "Returns the number of `all_changed_and_modified_files`"
|
||||
all_changed_files:
|
||||
description: "Returns all changed files i.e. *a combination of all added, copied, modified and renamed files (ACMR)*"
|
||||
description: "Returns all changed files i.e. a combination of all added, copied, modified and renamed files (ACMR)"
|
||||
all_changed_files_count:
|
||||
description: "Returns the number of `all_changed_files`"
|
||||
any_changed:
|
||||
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
|
||||
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs have changed. This defaults to `true` when no patterns are specified. i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
|
||||
only_changed:
|
||||
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has changed. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
|
||||
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs have changed. i.e. *includes a combination of all added, copied, modified and renamed files (ACMR)*."
|
||||
other_changed_files:
|
||||
description: "Returns all other changed files not listed in the files input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
|
||||
description: "Returns all other changed files not listed in the files input i.e. includes a combination of all added, copied, modified and renamed files (ACMR)."
|
||||
other_changed_files_count:
|
||||
description: "Returns the number of `other_changed_files`"
|
||||
all_modified_files:
|
||||
description: "Returns all changed files i.e. *a combination of all added, copied, modified, renamed and deleted files (ACMRD)*."
|
||||
description: "Returns all changed files i.e. a combination of all added, copied, modified, renamed and deleted files (ACMRD)."
|
||||
all_modified_files_count:
|
||||
description: "Returns the number of `all_modified_files`"
|
||||
any_modified:
|
||||
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has been modified. i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
|
||||
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs have been modified. This defaults to `true` when no patterns are specified. i.e. *includes a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
|
||||
only_modified:
|
||||
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has been modified. (ACMRD)."
|
||||
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs have been modified. (ACMRD)."
|
||||
other_modified_files:
|
||||
description: "Returns all other modified files not listed in the files input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)*"
|
||||
description: "Returns all other modified files not listed in the files input i.e. a combination of all added, copied, modified, and deleted files (ACMRD)"
|
||||
other_modified_files_count:
|
||||
description: "Returns the number of `other_modified_files`"
|
||||
any_deleted:
|
||||
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs has been deleted. (D)"
|
||||
description: "Returns `true` when any of the filenames provided using the `files*` or `files_ignore*` inputs have been deleted. This defaults to `true` when no patterns are specified. (D)"
|
||||
only_deleted:
|
||||
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs has been deleted. (D)"
|
||||
description: "Returns `true` when only files provided using the `files*` or `files_ignore*` inputs have been deleted. (D)"
|
||||
other_deleted_files:
|
||||
description: "Returns all other deleted files not listed in the files input i.e. *a combination of all deleted files (D)*"
|
||||
description: "Returns all other deleted files not listed in the files input i.e. a combination of all deleted files (D)"
|
||||
other_deleted_files_count:
|
||||
description: "Returns the number of `other_deleted_files`"
|
||||
modified_keys:
|
||||
description: "Returns all modified YAML keys when the `files_yaml` input is used. i.e. key that contains any path that has either been added, copied, modified, and deleted (ACMRD)"
|
||||
changed_keys:
|
||||
description: "Returns all changed YAML keys when the `files_yaml` input is used. i.e. key that contains any path that has either been added, copied, modified, and renamed (ACMR)"
|
||||
|
||||
runs:
|
||||
using: 'node16'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
||||
branding:
|
||||
|
|
42742
dist/index.js
generated
vendored
42742
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
5408
dist/licenses.txt
generated
vendored
5408
dist/licenses.txt
generated
vendored
File diff suppressed because it is too large
Load diff
2
dist/sourcemap-register.js
generated
vendored
2
dist/sourcemap-register.js
generated
vendored
File diff suppressed because one or more lines are too long
|
@ -10,4 +10,4 @@ module.exports = {
|
|||
setupFiles: [
|
||||
"<rootDir>/jest/setupEnv.cjs"
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const path = require('path')
|
||||
|
||||
process.env.TESTING = "1"
|
||||
process.env.GITHUB_WORKSPACE = path.join(
|
||||
path.resolve(__dirname, '..'), '.'
|
||||
)
|
||||
|
|
36
package.json
36
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@tj-actions/changed-files",
|
||||
"version": "37.4.0",
|
||||
"version": "45.0.8",
|
||||
"description": "Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.",
|
||||
"main": "lib/main.js",
|
||||
"publishConfig": {
|
||||
|
@ -8,12 +8,13 @@
|
|||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "eslint **/*.ts --max-warnings 0",
|
||||
"lint:fix": "eslint --fix src/**/*.ts",
|
||||
"format": "prettier --write src/*.ts src/**/*.ts",
|
||||
"format-check": "prettier --check src/*.ts src/**/*.ts",
|
||||
"lint": "eslint src/*.ts src/**/*.ts --max-warnings 0",
|
||||
"lint:fix": "eslint --fix src/*.ts src/**/*.ts",
|
||||
"package": "ncc build lib/main.js --source-map --license licenses.txt",
|
||||
"test": "jest --coverage",
|
||||
"update-snapshot": "jest -u",
|
||||
"all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -34,27 +35,28 @@
|
|||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^5.1.1",
|
||||
"@octokit/rest": "^19.0.13",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@octokit/rest": "^22.0.0",
|
||||
"@stdlib/utils-convert-path": "^0.2.1",
|
||||
"lodash": "^4.17.21",
|
||||
"micromatch": "^4.0.5",
|
||||
"yaml": "^2.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.2",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/lodash": "^4.14.195",
|
||||
"@types/micromatch": "^4.0.2",
|
||||
"@types/node": "^20.3.2",
|
||||
"@types/uuid": "^9.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"@types/node": "^24.0.1",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"@vercel/ncc": "^0.38.0",
|
||||
"eslint": "^8.43.0",
|
||||
"eslint-plugin-github": "^4.8.0",
|
||||
"eslint-plugin-jest": "^27.2.2",
|
||||
"eslint-config-prettier": "^10.0.0",
|
||||
"eslint-plugin-github": "^5.0.0",
|
||||
"eslint-plugin-jest": "^29.0.1",
|
||||
"eslint-plugin-prettier": "^5.0.0-alpha.2",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"jest": "^29.5.0",
|
||||
"jest": "^30.0.3",
|
||||
"prettier": "^3.0.0",
|
||||
"ts-jest": "^29.1.0",
|
||||
"typescript": "^5.1.3"
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"enabled": true,
|
||||
"prHourlyLimit": 10,
|
||||
"prConcurrentLimit": 5,
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"addLabels": [
|
||||
"dependencies",
|
||||
"merge when passing"
|
||||
],
|
||||
"assignees": [
|
||||
"jackton1"
|
||||
],
|
||||
"assignAutomerge": true,
|
||||
"dependencyDashboard": true,
|
||||
"dependencyDashboardAutoclose": true,
|
||||
"lockFileMaintenance": {
|
||||
"enabled": true,
|
||||
"automerge": true
|
||||
},
|
||||
"nvm": {
|
||||
"enabled": false
|
||||
},
|
||||
"packageRules": [
|
||||
{
|
||||
"matchUpdateTypes": [
|
||||
"minor",
|
||||
"patch",
|
||||
"pin",
|
||||
"digest"
|
||||
],
|
||||
"automerge": true,
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"addLabels": [
|
||||
"merge when passing"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "docker images",
|
||||
"matchLanguages": [
|
||||
"docker"
|
||||
],
|
||||
"matchUpdateTypes": [
|
||||
"minor",
|
||||
"patch",
|
||||
"pin",
|
||||
"digest"
|
||||
],
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"addLabels": [
|
||||
"merge when passing"
|
||||
],
|
||||
"automerge": true
|
||||
}
|
||||
]
|
||||
}
|
373
src/__tests__/__snapshots__/inputs.test.ts.snap
Normal file
373
src/__tests__/__snapshots__/inputs.test.ts.snap
Normal file
|
@ -0,0 +1,373 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`getInputs should correctly parse boolean inputs 1`] = `
|
||||
{
|
||||
"apiUrl": "",
|
||||
"baseSha": "",
|
||||
"diffRelative": "false",
|
||||
"dirNames": "false",
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": "false",
|
||||
"dirNamesExcludeCurrentDir": "false",
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"escapeJson": false,
|
||||
"excludeSubmodules": "false",
|
||||
"failOnInitialDiffError": "false",
|
||||
"failOnSubmoduleDiffError": "false",
|
||||
"fetchAdditionalSubmoduleHistory": "false",
|
||||
"fetchMissingHistoryMaxRetries": 20,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": "false",
|
||||
"json": true,
|
||||
"negationPatternsFirst": "false",
|
||||
"oldNewFilesSeparator": " ",
|
||||
"oldNewSeparator": ",",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": "false",
|
||||
"path": ".",
|
||||
"quotepath": "false",
|
||||
"recoverDeletedFiles": "false",
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "
|
||||
",
|
||||
"recoverFilesSeparator": "
|
||||
",
|
||||
"safeOutput": "false",
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": "false",
|
||||
"skipInitialFetch": "true",
|
||||
"tagsIgnorePattern": "",
|
||||
"tagsPattern": "*",
|
||||
"token": "",
|
||||
"until": "",
|
||||
"usePosixPathSeparator": "false",
|
||||
"useRestApi": "false",
|
||||
"writeOutputFiles": "false",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should correctly parse numeric inputs 1`] = `
|
||||
{
|
||||
"apiUrl": "",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"dirNamesMaxDepth": 2,
|
||||
"escapeJson": false,
|
||||
"excludeSubmodules": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"fetchDepth": 5,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": "",
|
||||
"oldNewSeparator": "",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": "",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "",
|
||||
"recoverFilesSeparator": "",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"tagsIgnorePattern": "",
|
||||
"tagsPattern": "",
|
||||
"token": "",
|
||||
"until": "",
|
||||
"usePosixPathSeparator": false,
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should correctly parse string inputs 1`] = `
|
||||
{
|
||||
"apiUrl": "https://api.github.com",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"escapeJson": false,
|
||||
"excludeSubmodules": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": "",
|
||||
"oldNewSeparator": "",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": "",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "",
|
||||
"recoverFilesSeparator": "",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"tagsIgnorePattern": "",
|
||||
"tagsPattern": "",
|
||||
"token": "token",
|
||||
"until": "",
|
||||
"usePosixPathSeparator": false,
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should handle invalid numeric inputs correctly 1`] = `
|
||||
{
|
||||
"apiUrl": "",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"dirNamesMaxDepth": 2,
|
||||
"escapeJson": false,
|
||||
"excludeSubmodules": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"fetchDepth": NaN,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": "",
|
||||
"oldNewSeparator": "",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": "",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "",
|
||||
"recoverFilesSeparator": "",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"tagsIgnorePattern": "",
|
||||
"tagsPattern": "",
|
||||
"token": "",
|
||||
"until": "",
|
||||
"usePosixPathSeparator": false,
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should handle negative numeric inputs correctly 1`] = `
|
||||
{
|
||||
"apiUrl": "",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"dirNamesMaxDepth": -2,
|
||||
"escapeJson": false,
|
||||
"excludeSubmodules": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"fetchDepth": 2,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": "",
|
||||
"oldNewSeparator": "",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": "",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "",
|
||||
"recoverFilesSeparator": "",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"tagsIgnorePattern": "",
|
||||
"tagsPattern": "",
|
||||
"token": "",
|
||||
"until": "",
|
||||
"usePosixPathSeparator": false,
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`getInputs should return default values when no inputs are provided 1`] = `
|
||||
{
|
||||
"apiUrl": "",
|
||||
"baseSha": "",
|
||||
"diffRelative": true,
|
||||
"dirNames": false,
|
||||
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
|
||||
"dirNamesExcludeCurrentDir": false,
|
||||
"dirNamesIncludeFiles": "",
|
||||
"dirNamesIncludeFilesSeparator": "",
|
||||
"escapeJson": false,
|
||||
"excludeSubmodules": false,
|
||||
"failOnInitialDiffError": false,
|
||||
"failOnSubmoduleDiffError": false,
|
||||
"fetchAdditionalSubmoduleHistory": false,
|
||||
"fetchMissingHistoryMaxRetries": 20,
|
||||
"files": "",
|
||||
"filesFromSourceFile": "",
|
||||
"filesFromSourceFileSeparator": "",
|
||||
"filesIgnore": "",
|
||||
"filesIgnoreFromSourceFile": "",
|
||||
"filesIgnoreFromSourceFileSeparator": "",
|
||||
"filesIgnoreSeparator": "",
|
||||
"filesIgnoreYaml": "",
|
||||
"filesIgnoreYamlFromSourceFile": "",
|
||||
"filesIgnoreYamlFromSourceFileSeparator": "",
|
||||
"filesSeparator": "",
|
||||
"filesYaml": "",
|
||||
"filesYamlFromSourceFile": "",
|
||||
"filesYamlFromSourceFileSeparator": "",
|
||||
"includeAllOldNewRenamedFiles": false,
|
||||
"json": false,
|
||||
"negationPatternsFirst": false,
|
||||
"oldNewFilesSeparator": " ",
|
||||
"oldNewSeparator": ",",
|
||||
"outputDir": "",
|
||||
"outputRenamedFilesAsDeletedAndAdded": false,
|
||||
"path": ".",
|
||||
"quotepath": true,
|
||||
"recoverDeletedFiles": false,
|
||||
"recoverDeletedFilesToDestination": "",
|
||||
"recoverFiles": "",
|
||||
"recoverFilesIgnore": "",
|
||||
"recoverFilesIgnoreSeparator": "
|
||||
",
|
||||
"recoverFilesSeparator": "
|
||||
",
|
||||
"safeOutput": false,
|
||||
"separator": "",
|
||||
"sha": "",
|
||||
"since": "",
|
||||
"sinceLastRemoteCommit": false,
|
||||
"skipInitialFetch": false,
|
||||
"tagsIgnorePattern": "",
|
||||
"tagsPattern": "*",
|
||||
"token": "",
|
||||
"until": "",
|
||||
"usePosixPathSeparator": false,
|
||||
"useRestApi": false,
|
||||
"writeOutputFiles": false,
|
||||
}
|
||||
`;
|
153
src/__tests__/inputs.test.ts
Normal file
153
src/__tests__/inputs.test.ts
Normal file
|
@ -0,0 +1,153 @@
|
|||
import * as core from '@actions/core'
|
||||
import {getInputs, Inputs} from '../inputs'
|
||||
import {DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS} from '../constant'
|
||||
|
||||
jest.mock('@actions/core')
|
||||
|
||||
describe('getInputs', () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
test('should return default values when no inputs are provided', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
'') as string
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should correctly parse boolean inputs', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
'') as string
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
switch (name) {
|
||||
case 'matrix':
|
||||
return 'true'
|
||||
case 'skip_initial_fetch':
|
||||
return 'true'
|
||||
default:
|
||||
return 'false'
|
||||
}
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should handle matrix alias correctly', () => {
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
return name === 'matrix' ? 'true' : 'false'
|
||||
})
|
||||
|
||||
const inputs = getInputs()
|
||||
expect(inputs).toHaveProperty('json', true)
|
||||
expect(inputs).toHaveProperty('escapeJson', false)
|
||||
})
|
||||
|
||||
test('should correctly parse string inputs', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
switch (name) {
|
||||
case 'token':
|
||||
return 'token'
|
||||
case 'api_url':
|
||||
return 'https://api.github.com'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should correctly parse numeric inputs', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
switch (name) {
|
||||
case 'fetch_depth':
|
||||
return '5'
|
||||
case 'dir_names_max_depth':
|
||||
return '2'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should handle invalid numeric inputs correctly', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
// TODO: Add validation for invalid numbers which should result in an error instead of NaN
|
||||
switch (name) {
|
||||
case 'fetch_depth':
|
||||
return 'invalid'
|
||||
case 'dir_names_max_depth':
|
||||
return '2'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('should handle negative numeric inputs correctly', () => {
|
||||
;(core.getInput as jest.Mock).mockImplementation(name => {
|
||||
// TODO: Add validation for negative numbers which should result in an error
|
||||
switch (name) {
|
||||
case 'fetch_depth':
|
||||
return '-5'
|
||||
case 'dir_names_max_depth':
|
||||
return '-2'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
;(core.getBooleanInput as jest.Mock).mockImplementation(name => {
|
||||
const camelCaseName = name.replace(/_([a-z])/g, (g: string[]) => {
|
||||
return g[1].toUpperCase()
|
||||
}) as keyof Inputs
|
||||
|
||||
return (DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[camelCaseName] ||
|
||||
false) as boolean
|
||||
})
|
||||
expect(getInputs()).toMatchSnapshot()
|
||||
})
|
||||
})
|
|
@ -1,5 +0,0 @@
|
|||
describe('main test', () => {
|
||||
it('adds two numbers', async () => {
|
||||
expect(1 + 1).toEqual(2)
|
||||
})
|
||||
})
|
|
@ -1,9 +1,14 @@
|
|||
import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import {ChangeTypeEnum} from '../changedFiles'
|
||||
import {Inputs} from '../inputs'
|
||||
import {
|
||||
getDirname,
|
||||
getDirnameMaxDepth,
|
||||
getFilteredChangedFiles,
|
||||
normalizeSeparators
|
||||
getPreviousGitTag,
|
||||
normalizeSeparators,
|
||||
warnUnsupportedRESTAPIInputs
|
||||
} from '../utils'
|
||||
|
||||
const originalPlatform = process.platform
|
||||
|
@ -575,4 +580,182 @@ describe('utils test', () => {
|
|||
expect(filteredFiles[ChangeTypeEnum.Modified]).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('warnUnsupportedRESTAPIInputs', () => {
|
||||
// Warns about unsupported inputs when using the REST API.
|
||||
it('should warn about unsupported inputs when all inputs are supported', async () => {
|
||||
const inputs: Inputs = {
|
||||
files: '',
|
||||
filesSeparator: '\n',
|
||||
filesFromSourceFile: '',
|
||||
filesFromSourceFileSeparator: '\n',
|
||||
filesYaml: '',
|
||||
filesYamlFromSourceFile: '',
|
||||
filesYamlFromSourceFileSeparator: '\n',
|
||||
filesIgnore: '',
|
||||
filesIgnoreSeparator: '\n',
|
||||
filesIgnoreFromSourceFile: '',
|
||||
filesIgnoreFromSourceFileSeparator: '\n',
|
||||
filesIgnoreYaml: '',
|
||||
filesIgnoreYamlFromSourceFile: '',
|
||||
filesIgnoreYamlFromSourceFileSeparator: '\n',
|
||||
separator: ' ',
|
||||
includeAllOldNewRenamedFiles: false,
|
||||
oldNewSeparator: ',',
|
||||
oldNewFilesSeparator: ' ',
|
||||
sha: '1313123',
|
||||
baseSha: '',
|
||||
since: '',
|
||||
until: '',
|
||||
path: '.',
|
||||
quotepath: true,
|
||||
diffRelative: true,
|
||||
dirNames: false,
|
||||
dirNamesMaxDepth: undefined,
|
||||
dirNamesExcludeCurrentDir: false,
|
||||
dirNamesIncludeFiles: '',
|
||||
dirNamesIncludeFilesSeparator: '\n',
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false,
|
||||
json: false,
|
||||
escapeJson: true,
|
||||
safeOutput: true,
|
||||
fetchDepth: 50,
|
||||
fetchAdditionalSubmoduleHistory: false,
|
||||
sinceLastRemoteCommit: false,
|
||||
writeOutputFiles: false,
|
||||
outputDir: '.github/outputs',
|
||||
outputRenamedFilesAsDeletedAndAdded: false,
|
||||
recoverDeletedFiles: false,
|
||||
recoverDeletedFilesToDestination: '',
|
||||
recoverFiles: '',
|
||||
recoverFilesSeparator: '\n',
|
||||
recoverFilesIgnore: '',
|
||||
recoverFilesIgnoreSeparator: '\n',
|
||||
token: '${{ github.token }}',
|
||||
apiUrl: '${{ github.api_url }}',
|
||||
skipInitialFetch: false,
|
||||
failOnInitialDiffError: false,
|
||||
failOnSubmoduleDiffError: false,
|
||||
negationPatternsFirst: false,
|
||||
useRestApi: false,
|
||||
excludeSubmodules: false,
|
||||
fetchMissingHistoryMaxRetries: 20,
|
||||
usePosixPathSeparator: false,
|
||||
tagsPattern: '*',
|
||||
tagsIgnorePattern: ''
|
||||
}
|
||||
|
||||
const coreWarningSpy = jest.spyOn(core, 'warning')
|
||||
|
||||
await warnUnsupportedRESTAPIInputs({
|
||||
inputs
|
||||
})
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledWith(
|
||||
'Input "sha" is not supported when using GitHub\'s REST API to get changed files'
|
||||
)
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
describe('getPreviousGitTag', () => {
|
||||
// Check if the environment variable GITHUB_REPOSITORY_OWNER is 'tj-actions'
|
||||
const shouldSkip = !!process.env.GITHUB_EVENT_PULL_REQUEST_HEAD_REPO_FORK
|
||||
// Function returns the second-latest tag and its SHA
|
||||
it('should return the second latest tag and its SHA when multiple tags are present', async () => {
|
||||
if (shouldSkip) {
|
||||
return
|
||||
}
|
||||
const result = await getPreviousGitTag({
|
||||
cwd: '.',
|
||||
tagsPattern: '*',
|
||||
tagsIgnorePattern: '',
|
||||
currentBranch: 'v1.0.1'
|
||||
})
|
||||
expect(result).toEqual({
|
||||
tag: 'v1.0.0',
|
||||
sha: 'f0751de6af436d4e79016e2041cf6400e0833653'
|
||||
})
|
||||
})
|
||||
// Tags are filtered by a specified pattern when 'tagsPattern' is provided
|
||||
it('should filter tags by the specified pattern', async () => {
|
||||
if (shouldSkip) {
|
||||
return
|
||||
}
|
||||
const result = await getPreviousGitTag({
|
||||
cwd: '.',
|
||||
tagsPattern: 'v1.*',
|
||||
tagsIgnorePattern: '',
|
||||
currentBranch: 'v1.0.1'
|
||||
})
|
||||
expect(result).toEqual({
|
||||
tag: 'v1.0.0',
|
||||
sha: 'f0751de6af436d4e79016e2041cf6400e0833653'
|
||||
})
|
||||
})
|
||||
// Tags are excluded by a specified ignore pattern when 'tagsIgnorePattern' is provided
|
||||
it('should exclude tags by the specified ignore pattern', async () => {
|
||||
if (shouldSkip) {
|
||||
return
|
||||
}
|
||||
const result = await getPreviousGitTag({
|
||||
cwd: '.',
|
||||
tagsPattern: '*',
|
||||
tagsIgnorePattern: 'v0.*.*',
|
||||
currentBranch: 'v1.0.1'
|
||||
})
|
||||
expect(result).toEqual({
|
||||
tag: 'v1.0.0',
|
||||
sha: 'f0751de6af436d4e79016e2041cf6400e0833653'
|
||||
})
|
||||
})
|
||||
|
||||
// No tags are available in the repository
|
||||
it('should return empty values when no tags are available in the repository', async () => {
|
||||
jest.spyOn(exec, 'getExecOutput').mockResolvedValueOnce({
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
exitCode: 0
|
||||
})
|
||||
const result = await getPreviousGitTag({
|
||||
cwd: '.',
|
||||
tagsPattern: '*',
|
||||
tagsIgnorePattern: '',
|
||||
currentBranch: ''
|
||||
})
|
||||
expect(result).toEqual({tag: '', sha: ''})
|
||||
})
|
||||
|
||||
// Only one tag is available, making it impossible to find a previous tag
|
||||
it('should return empty values when only one tag is available', async () => {
|
||||
jest.spyOn(exec, 'getExecOutput').mockResolvedValueOnce({
|
||||
stdout:
|
||||
'v1.0.1|f0751de6af436d4e79016e2041cf6400e0833653|2021-01-01T00:00:00Z',
|
||||
stderr: '',
|
||||
exitCode: 0
|
||||
})
|
||||
const result = await getPreviousGitTag({
|
||||
cwd: '.',
|
||||
tagsPattern: '*',
|
||||
tagsIgnorePattern: '',
|
||||
currentBranch: 'v1.0.1'
|
||||
})
|
||||
expect(result).toEqual({tag: '', sha: ''})
|
||||
})
|
||||
|
||||
// Git commands fail and throw errors
|
||||
it('should throw an error when git commands fail', async () => {
|
||||
jest
|
||||
.spyOn(exec, 'getExecOutput')
|
||||
.mockRejectedValue(new Error('git command failed'))
|
||||
await expect(
|
||||
getPreviousGitTag({
|
||||
cwd: '.',
|
||||
tagsPattern: '*',
|
||||
tagsIgnorePattern: '',
|
||||
currentBranch: 'v1.0.1'
|
||||
})
|
||||
).rejects.toThrow('git command failed')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -2,9 +2,10 @@ import * as core from '@actions/core'
|
|||
import * as github from '@actions/github'
|
||||
import type {RestEndpointMethodTypes} from '@octokit/rest'
|
||||
import flatten from 'lodash/flatten'
|
||||
import convertPath from '@stdlib/utils-convert-path'
|
||||
import mm from 'micromatch'
|
||||
import * as path from 'path'
|
||||
|
||||
import {setOutputsAndGetModifiedAndChangedFilesStatus} from './changedFilesOutput'
|
||||
import {DiffResult} from './commitSha'
|
||||
import {Inputs} from './inputs'
|
||||
import {
|
||||
|
@ -12,22 +13,118 @@ import {
|
|||
getAllChangedFiles,
|
||||
getDirnameMaxDepth,
|
||||
getDirNamesIncludeFilesPattern,
|
||||
getFilteredChangedFiles,
|
||||
gitRenamedFiles,
|
||||
gitSubmoduleDiffSHA,
|
||||
isWindows,
|
||||
jsonOutput
|
||||
jsonOutput,
|
||||
setArrayOutput
|
||||
} from './utils'
|
||||
|
||||
export const processChangedFiles = async ({
|
||||
filePatterns,
|
||||
allDiffFiles,
|
||||
inputs,
|
||||
yamlFilePatterns,
|
||||
workingDirectory
|
||||
}: {
|
||||
filePatterns: string[]
|
||||
allDiffFiles: ChangedFiles
|
||||
inputs: Inputs
|
||||
yamlFilePatterns: Record<string, string[]>
|
||||
workingDirectory?: string
|
||||
}): Promise<void> => {
|
||||
if (filePatterns.length > 0) {
|
||||
core.startGroup('changed-files-patterns')
|
||||
const allFilteredDiffFiles = await getFilteredChangedFiles({
|
||||
allDiffFiles,
|
||||
filePatterns
|
||||
})
|
||||
core.debug(
|
||||
`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`
|
||||
)
|
||||
await setOutputsAndGetModifiedAndChangedFilesStatus({
|
||||
allDiffFiles,
|
||||
allFilteredDiffFiles,
|
||||
inputs,
|
||||
filePatterns,
|
||||
workingDirectory
|
||||
})
|
||||
core.info('All Done!')
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
if (Object.keys(yamlFilePatterns).length > 0) {
|
||||
const modifiedKeys: string[] = []
|
||||
const changedKeys: string[] = []
|
||||
|
||||
for (const key of Object.keys(yamlFilePatterns)) {
|
||||
core.startGroup(`changed-files-yaml-${key}`)
|
||||
const allFilteredDiffFiles = await getFilteredChangedFiles({
|
||||
allDiffFiles,
|
||||
filePatterns: yamlFilePatterns[key]
|
||||
})
|
||||
core.debug(
|
||||
`All filtered diff files for ${key}: ${JSON.stringify(
|
||||
allFilteredDiffFiles
|
||||
)}`
|
||||
)
|
||||
const {anyChanged, anyModified} =
|
||||
await setOutputsAndGetModifiedAndChangedFilesStatus({
|
||||
allDiffFiles,
|
||||
allFilteredDiffFiles,
|
||||
inputs,
|
||||
filePatterns: yamlFilePatterns[key],
|
||||
outputPrefix: key,
|
||||
workingDirectory
|
||||
})
|
||||
if (anyModified) {
|
||||
modifiedKeys.push(key)
|
||||
}
|
||||
if (anyChanged) {
|
||||
changedKeys.push(key)
|
||||
}
|
||||
|
||||
core.info('All Done!')
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
await setArrayOutput({
|
||||
key: 'modified_keys',
|
||||
inputs,
|
||||
value: modifiedKeys
|
||||
})
|
||||
|
||||
await setArrayOutput({
|
||||
key: 'changed_keys',
|
||||
inputs,
|
||||
value: changedKeys
|
||||
})
|
||||
}
|
||||
|
||||
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
|
||||
core.startGroup('changed-files-all')
|
||||
await setOutputsAndGetModifiedAndChangedFilesStatus({
|
||||
allDiffFiles,
|
||||
allFilteredDiffFiles: allDiffFiles,
|
||||
inputs,
|
||||
workingDirectory
|
||||
})
|
||||
core.info('All Done!')
|
||||
core.endGroup()
|
||||
}
|
||||
}
|
||||
|
||||
export const getRenamedFiles = async ({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffSubmodule,
|
||||
diffResult,
|
||||
submodulePaths
|
||||
}: {
|
||||
inputs: Inputs
|
||||
workingDirectory: string
|
||||
hasSubmodule: boolean
|
||||
diffSubmodule: boolean
|
||||
diffResult: DiffResult
|
||||
submodulePaths: string[]
|
||||
}): Promise<{paths: string; count: string}> => {
|
||||
|
@ -39,7 +136,7 @@ export const getRenamedFiles = async ({
|
|||
oldNewSeparator: inputs.oldNewSeparator
|
||||
})
|
||||
|
||||
if (hasSubmodule) {
|
||||
if (diffSubmodule) {
|
||||
for (const submodulePath of submodulePaths) {
|
||||
const submoduleShaResult = await gitSubmoduleDiffSHA({
|
||||
cwd: workingDirectory,
|
||||
|
@ -66,7 +163,7 @@ export const getRenamedFiles = async ({
|
|||
}))
|
||||
) {
|
||||
let message = `Unable to use three dot diff for: ${submodulePath} submodule. Falling back to two dot diff. You can set 'fetch_additional_submodule_history: true' to fetch additional submodule history in order to use three dot diff`
|
||||
if (inputs.fetchSubmoduleHistory) {
|
||||
if (inputs.fetchAdditionalSubmoduleHistory) {
|
||||
message = `To fetch additional submodule history for: ${submodulePath} you can increase history depth using 'fetch_depth' input`
|
||||
}
|
||||
core.info(message)
|
||||
|
@ -117,28 +214,33 @@ export type ChangedFiles = {
|
|||
|
||||
export const getAllDiffFiles = async ({
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffSubmodule,
|
||||
diffResult,
|
||||
submodulePaths,
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
fetchSubmoduleHistory
|
||||
fetchAdditionalSubmoduleHistory,
|
||||
failOnInitialDiffError,
|
||||
failOnSubmoduleDiffError
|
||||
}: {
|
||||
workingDirectory: string
|
||||
hasSubmodule: boolean
|
||||
diffSubmodule: boolean
|
||||
diffResult: DiffResult
|
||||
submodulePaths: string[]
|
||||
outputRenamedFilesAsDeletedAndAdded: boolean
|
||||
fetchSubmoduleHistory: boolean
|
||||
fetchAdditionalSubmoduleHistory: boolean
|
||||
failOnInitialDiffError: boolean
|
||||
failOnSubmoduleDiffError: boolean
|
||||
}): Promise<ChangedFiles> => {
|
||||
const files = await getAllChangedFiles({
|
||||
cwd: workingDirectory,
|
||||
sha1: diffResult.previousSha,
|
||||
sha2: diffResult.currentSha,
|
||||
diff: diffResult.diff,
|
||||
outputRenamedFilesAsDeletedAndAdded
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
failOnInitialDiffError
|
||||
})
|
||||
|
||||
if (hasSubmodule) {
|
||||
if (diffSubmodule) {
|
||||
for (const submodulePath of submodulePaths) {
|
||||
const submoduleShaResult = await gitSubmoduleDiffSHA({
|
||||
cwd: workingDirectory,
|
||||
|
@ -165,7 +267,7 @@ export const getAllDiffFiles = async ({
|
|||
}))
|
||||
) {
|
||||
let message = `Set 'fetch_additional_submodule_history: true' to fetch additional submodule history for: ${submodulePath}`
|
||||
if (fetchSubmoduleHistory) {
|
||||
if (fetchAdditionalSubmoduleHistory) {
|
||||
message = `To fetch additional submodule history for: ${submodulePath} you can increase history depth using 'fetch_depth' input`
|
||||
}
|
||||
core.warning(message)
|
||||
|
@ -179,7 +281,8 @@ export const getAllDiffFiles = async ({
|
|||
diff,
|
||||
isSubmodule: true,
|
||||
parentDir: submodulePath,
|
||||
outputRenamedFilesAsDeletedAndAdded
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
failOnSubmoduleDiffError
|
||||
})
|
||||
|
||||
for (const changeType of Object.keys(
|
||||
|
@ -249,7 +352,11 @@ function* getChangeTypeFilesGenerator({
|
|||
filePaths,
|
||||
dirNamesIncludeFilePatterns
|
||||
})) {
|
||||
yield filePath
|
||||
if (isWindows() && inputs.usePosixPathSeparator) {
|
||||
yield convertPath(filePath, 'mixed')
|
||||
} else {
|
||||
yield filePath
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -262,20 +369,15 @@ export const getChangeTypeFiles = async ({
|
|||
inputs: Inputs
|
||||
changedFiles: ChangedFiles
|
||||
changeTypes: ChangeTypeEnum[]
|
||||
}): Promise<{paths: string; count: string}> => {
|
||||
}): Promise<{paths: string[] | string; count: string}> => {
|
||||
const files = [
|
||||
...new Set(getChangeTypeFilesGenerator({inputs, changedFiles, changeTypes}))
|
||||
].filter(Boolean)
|
||||
|
||||
if (inputs.json) {
|
||||
return {
|
||||
paths: jsonOutput({value: files, shouldEscape: inputs.escapeJson}),
|
||||
count: files.length.toString()
|
||||
}
|
||||
}
|
||||
const paths = inputs.json ? files : files.join(inputs.separator)
|
||||
|
||||
return {
|
||||
paths: files.join(inputs.separator),
|
||||
paths,
|
||||
count: files.length.toString()
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +403,11 @@ function* getAllChangeTypeFilesGenerator({
|
|||
filePaths,
|
||||
dirNamesIncludeFilePatterns
|
||||
})) {
|
||||
yield filePath
|
||||
if (isWindows() && inputs.usePosixPathSeparator) {
|
||||
yield convertPath(filePath, 'mixed')
|
||||
} else {
|
||||
yield filePath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,20 +417,15 @@ export const getAllChangeTypeFiles = async ({
|
|||
}: {
|
||||
inputs: Inputs
|
||||
changedFiles: ChangedFiles
|
||||
}): Promise<{paths: string; count: string}> => {
|
||||
}): Promise<{paths: string[] | string; count: string}> => {
|
||||
const files = [
|
||||
...new Set(getAllChangeTypeFilesGenerator({inputs, changedFiles}))
|
||||
].filter(Boolean)
|
||||
|
||||
if (inputs.json) {
|
||||
return {
|
||||
paths: jsonOutput({value: files, shouldEscape: inputs.escapeJson}),
|
||||
count: files.length.toString()
|
||||
}
|
||||
}
|
||||
const paths = inputs.json ? files : files.join(inputs.separator)
|
||||
|
||||
return {
|
||||
paths: files.join(inputs.separator),
|
||||
paths,
|
||||
count: files.length.toString()
|
||||
}
|
||||
}
|
||||
|
@ -379,7 +480,7 @@ export const getChangedFilesFromGithubAPI = async ({
|
|||
|
||||
if (changeType === ChangeTypeEnum.Renamed) {
|
||||
if (inputs.outputRenamedFilesAsDeletedAndAdded) {
|
||||
changedFiles[ChangeTypeEnum.Deleted].push(item.filename)
|
||||
changedFiles[ChangeTypeEnum.Deleted].push(item.previous_filename || '')
|
||||
changedFiles[ChangeTypeEnum.Added].push(item.filename)
|
||||
} else {
|
||||
changedFiles[ChangeTypeEnum.Renamed].push(item.filename)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as core from '@actions/core'
|
||||
import path from 'path'
|
||||
import {
|
||||
ChangedFiles,
|
||||
ChangeTypeEnum,
|
||||
|
@ -6,25 +7,30 @@ import {
|
|||
getChangeTypeFiles
|
||||
} from './changedFiles'
|
||||
import {Inputs} from './inputs'
|
||||
import {setOutput} from './utils'
|
||||
import {getOutputKey, setArrayOutput, setOutput, exists} from './utils'
|
||||
|
||||
const getOutputKey = (key: string, outputPrefix: string): string => {
|
||||
return outputPrefix ? `${outputPrefix}_${key}` : key
|
||||
const getArrayFromPaths = (
|
||||
paths: string | string[],
|
||||
inputs: Inputs
|
||||
): string[] => {
|
||||
return Array.isArray(paths) ? paths : paths.split(inputs.separator)
|
||||
}
|
||||
|
||||
export const setChangedFilesOutput = async ({
|
||||
export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
allDiffFiles,
|
||||
allFilteredDiffFiles,
|
||||
inputs,
|
||||
filePatterns = [],
|
||||
outputPrefix = ''
|
||||
outputPrefix = '',
|
||||
workingDirectory
|
||||
}: {
|
||||
allDiffFiles: ChangedFiles
|
||||
allFilteredDiffFiles: ChangedFiles
|
||||
inputs: Inputs
|
||||
filePatterns?: string[]
|
||||
outputPrefix?: string
|
||||
}): Promise<void> => {
|
||||
workingDirectory?: string
|
||||
}): Promise<{anyModified: boolean; anyChanged: boolean}> => {
|
||||
const addedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
|
@ -34,12 +40,24 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('added_files', outputPrefix),
|
||||
value: addedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
await setOutput({
|
||||
key: getOutputKey('added_files_count', outputPrefix),
|
||||
value: addedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
await setOutput({
|
||||
key: getOutputKey('any_added', outputPrefix),
|
||||
value: addedFiles.paths.length > 0,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
const copiedFiles = await getChangeTypeFiles({
|
||||
|
@ -51,13 +69,18 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('copied_files', outputPrefix),
|
||||
value: copiedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('copied_files_count', outputPrefix),
|
||||
value: copiedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const modifiedFiles = await getChangeTypeFiles({
|
||||
|
@ -69,13 +92,18 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('modified_files', outputPrefix),
|
||||
value: modifiedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('modified_files_count', outputPrefix),
|
||||
value: modifiedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const renamedFiles = await getChangeTypeFiles({
|
||||
|
@ -87,13 +115,18 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('renamed_files', outputPrefix),
|
||||
value: renamedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('renamed_files_count', outputPrefix),
|
||||
value: renamedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const typeChangedFiles = await getChangeTypeFiles({
|
||||
|
@ -105,13 +138,18 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('type_changed_files', outputPrefix),
|
||||
value: typeChangedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('type_changed_files_count', outputPrefix),
|
||||
value: typeChangedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const unmergedFiles = await getChangeTypeFiles({
|
||||
|
@ -123,13 +161,18 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('unmerged_files', outputPrefix),
|
||||
value: unmergedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('unmerged_files_count', outputPrefix),
|
||||
value: unmergedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const unknownFiles = await getChangeTypeFiles({
|
||||
|
@ -141,13 +184,18 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('unknown_files', outputPrefix),
|
||||
value: unknownFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('unknown_files_count', outputPrefix),
|
||||
value: unknownFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const allChangedAndModifiedFiles = await getAllChangeTypeFiles({
|
||||
|
@ -162,13 +210,18 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('all_changed_and_modified_files', outputPrefix),
|
||||
value: allChangedAndModifiedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('all_changed_and_modified_files_count', outputPrefix),
|
||||
value: allChangedAndModifiedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const allChangedFiles = await getChangeTypeFiles({
|
||||
|
@ -185,19 +238,26 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('all_changed_files', outputPrefix),
|
||||
value: allChangedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('all_changed_files_count', outputPrefix),
|
||||
value: allChangedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('any_changed', outputPrefix),
|
||||
value: allChangedFiles.paths.length > 0 && filePatterns.length > 0,
|
||||
inputs
|
||||
value: allChangedFiles.paths.length > 0,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
const allOtherChangedFiles = await getChangeTypeFiles({
|
||||
|
@ -212,12 +272,18 @@ export const setChangedFilesOutput = async ({
|
|||
})
|
||||
core.debug(`All other changed files: ${JSON.stringify(allOtherChangedFiles)}`)
|
||||
|
||||
const otherChangedFiles = allOtherChangedFiles.paths
|
||||
.split(inputs.separator)
|
||||
.filter(
|
||||
(filePath: string) =>
|
||||
!allChangedFiles.paths.split(inputs.separator).includes(filePath)
|
||||
)
|
||||
const allOtherChangedFilesPaths: string[] = getArrayFromPaths(
|
||||
allOtherChangedFiles.paths,
|
||||
inputs
|
||||
)
|
||||
const allChangedFilesPaths: string[] = getArrayFromPaths(
|
||||
allChangedFiles.paths,
|
||||
inputs
|
||||
)
|
||||
|
||||
const otherChangedFiles = allOtherChangedFilesPaths.filter(
|
||||
(filePath: string) => !allChangedFilesPaths.includes(filePath)
|
||||
)
|
||||
|
||||
const onlyChanged =
|
||||
otherChangedFiles.length === 0 &&
|
||||
|
@ -227,19 +293,23 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('only_changed', outputPrefix),
|
||||
value: onlyChanged,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_changed_files', outputPrefix),
|
||||
value: otherChangedFiles.join(inputs.separator),
|
||||
inputs
|
||||
await setArrayOutput({
|
||||
key: 'other_changed_files',
|
||||
inputs,
|
||||
value: otherChangedFiles,
|
||||
outputPrefix
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_changed_files_count', outputPrefix),
|
||||
value: otherChangedFiles.length.toString(),
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const allModifiedFiles = await getChangeTypeFiles({
|
||||
|
@ -257,19 +327,26 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('all_modified_files', outputPrefix),
|
||||
value: allModifiedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('all_modified_files_count', outputPrefix),
|
||||
value: allModifiedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('any_modified', outputPrefix),
|
||||
value: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
|
||||
inputs
|
||||
value: allModifiedFiles.paths.length > 0,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
const allOtherModifiedFiles = await getChangeTypeFiles({
|
||||
|
@ -284,12 +361,19 @@ export const setChangedFilesOutput = async ({
|
|||
]
|
||||
})
|
||||
|
||||
const otherModifiedFiles = allOtherModifiedFiles.paths
|
||||
.split(inputs.separator)
|
||||
.filter(
|
||||
(filePath: string) =>
|
||||
!allModifiedFiles.paths.split(inputs.separator).includes(filePath)
|
||||
)
|
||||
const allOtherModifiedFilesPaths: string[] = getArrayFromPaths(
|
||||
allOtherModifiedFiles.paths,
|
||||
inputs
|
||||
)
|
||||
|
||||
const allModifiedFilesPaths: string[] = getArrayFromPaths(
|
||||
allModifiedFiles.paths,
|
||||
inputs
|
||||
)
|
||||
|
||||
const otherModifiedFiles = allOtherModifiedFilesPaths.filter(
|
||||
(filePath: string) => !allModifiedFilesPaths.includes(filePath)
|
||||
)
|
||||
|
||||
const onlyModified =
|
||||
otherModifiedFiles.length === 0 &&
|
||||
|
@ -299,19 +383,23 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('only_modified', outputPrefix),
|
||||
value: onlyModified,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_modified_files', outputPrefix),
|
||||
value: otherModifiedFiles.join(inputs.separator),
|
||||
inputs
|
||||
await setArrayOutput({
|
||||
key: 'other_modified_files',
|
||||
inputs,
|
||||
value: otherModifiedFiles,
|
||||
outputPrefix
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_modified_files_count', outputPrefix),
|
||||
value: otherModifiedFiles.length.toString(),
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
const deletedFiles = await getChangeTypeFiles({
|
||||
|
@ -320,22 +408,51 @@ export const setChangedFilesOutput = async ({
|
|||
changeTypes: [ChangeTypeEnum.Deleted]
|
||||
})
|
||||
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`)
|
||||
|
||||
if (
|
||||
inputs.dirNamesDeletedFilesIncludeOnlyDeletedDirs &&
|
||||
inputs.dirNames &&
|
||||
workingDirectory
|
||||
) {
|
||||
const newDeletedFilesPaths: string[] = []
|
||||
for (const deletedPath of getArrayFromPaths(deletedFiles.paths, inputs)) {
|
||||
const dirPath = path.join(workingDirectory, deletedPath)
|
||||
core.debug(`Checking if directory exists: ${dirPath}`)
|
||||
if (!(await exists(dirPath))) {
|
||||
core.debug(`Directory not found: ${dirPath}`)
|
||||
newDeletedFilesPaths.push(deletedPath)
|
||||
}
|
||||
}
|
||||
deletedFiles.paths = inputs.json
|
||||
? newDeletedFilesPaths
|
||||
: newDeletedFilesPaths.join(inputs.separator)
|
||||
deletedFiles.count = newDeletedFilesPaths.length.toString()
|
||||
core.debug(`New deleted files: ${JSON.stringify(deletedFiles)}`)
|
||||
}
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('deleted_files', outputPrefix),
|
||||
value: deletedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('deleted_files_count', outputPrefix),
|
||||
value: deletedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('any_deleted', outputPrefix),
|
||||
value: deletedFiles.paths.length > 0 && filePatterns.length > 0,
|
||||
inputs
|
||||
value: deletedFiles.paths.length > 0,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
const allOtherDeletedFiles = await getChangeTypeFiles({
|
||||
|
@ -344,11 +461,19 @@ export const setChangedFilesOutput = async ({
|
|||
changeTypes: [ChangeTypeEnum.Deleted]
|
||||
})
|
||||
|
||||
const otherDeletedFiles = allOtherDeletedFiles.paths
|
||||
.split(inputs.separator)
|
||||
.filter(
|
||||
filePath => !deletedFiles.paths.split(inputs.separator).includes(filePath)
|
||||
)
|
||||
const allOtherDeletedFilesPaths: string[] = getArrayFromPaths(
|
||||
allOtherDeletedFiles.paths,
|
||||
inputs
|
||||
)
|
||||
|
||||
const deletedFilesPaths: string[] = getArrayFromPaths(
|
||||
deletedFiles.paths,
|
||||
inputs
|
||||
)
|
||||
|
||||
const otherDeletedFiles = allOtherDeletedFilesPaths.filter(
|
||||
filePath => !deletedFilesPaths.includes(filePath)
|
||||
)
|
||||
|
||||
const onlyDeleted =
|
||||
otherDeletedFiles.length === 0 &&
|
||||
|
@ -358,18 +483,27 @@ export const setChangedFilesOutput = async ({
|
|||
await setOutput({
|
||||
key: getOutputKey('only_deleted', outputPrefix),
|
||||
value: onlyDeleted,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_deleted_files', outputPrefix),
|
||||
value: otherDeletedFiles.join(inputs.separator),
|
||||
inputs
|
||||
await setArrayOutput({
|
||||
key: 'other_deleted_files',
|
||||
inputs,
|
||||
value: otherDeletedFiles,
|
||||
outputPrefix
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_deleted_files_count', outputPrefix),
|
||||
value: otherDeletedFiles.length.toString(),
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
})
|
||||
|
||||
return {
|
||||
anyModified: allModifiedFiles.paths.length > 0,
|
||||
anyChanged: allChangedFiles.paths.length > 0
|
||||
}
|
||||
}
|
||||
|
|
233
src/commitSha.ts
233
src/commitSha.ts
|
@ -5,6 +5,8 @@ import {Env} from './env'
|
|||
import {Inputs} from './inputs'
|
||||
import {
|
||||
canDiffCommits,
|
||||
cleanShaInput,
|
||||
getCurrentBranchName,
|
||||
getHeadSha,
|
||||
getParentSha,
|
||||
getPreviousGitTag,
|
||||
|
@ -22,7 +24,11 @@ const getCurrentSHA = async ({
|
|||
inputs: Inputs
|
||||
workingDirectory: string
|
||||
}): Promise<string> => {
|
||||
let currentSha = inputs.sha
|
||||
let currentSha = await cleanShaInput({
|
||||
sha: inputs.sha,
|
||||
cwd: workingDirectory,
|
||||
token: inputs.token
|
||||
})
|
||||
core.debug('Getting current SHA...')
|
||||
|
||||
if (inputs.until) {
|
||||
|
@ -80,17 +86,29 @@ export interface DiffResult {
|
|||
initialCommit?: boolean
|
||||
}
|
||||
|
||||
export const getSHAForNonPullRequestEvent = async (
|
||||
inputs: Inputs,
|
||||
env: Env,
|
||||
workingDirectory: string,
|
||||
isShallow: boolean,
|
||||
hasSubmodule: boolean,
|
||||
gitFetchExtraArgs: string[],
|
||||
interface SHAForNonPullRequestEvent {
|
||||
inputs: Inputs
|
||||
env: Env
|
||||
workingDirectory: string
|
||||
isShallow: boolean
|
||||
diffSubmodule: boolean
|
||||
gitFetchExtraArgs: string[]
|
||||
isTag: boolean
|
||||
): Promise<DiffResult> => {
|
||||
remoteName: string
|
||||
}
|
||||
|
||||
export const getSHAForNonPullRequestEvent = async ({
|
||||
inputs,
|
||||
env,
|
||||
workingDirectory,
|
||||
isShallow,
|
||||
diffSubmodule,
|
||||
gitFetchExtraArgs,
|
||||
isTag,
|
||||
remoteName
|
||||
}: SHAForNonPullRequestEvent): Promise<DiffResult> => {
|
||||
let targetBranch = env.GITHUB_REF_NAME
|
||||
const currentBranch = targetBranch
|
||||
let currentBranch = targetBranch
|
||||
let initialCommit = false
|
||||
|
||||
if (!inputs.skipInitialFetch) {
|
||||
|
@ -116,8 +134,8 @@ export const getSHAForNonPullRequestEvent = async (
|
|||
'-u',
|
||||
'--progress',
|
||||
`--deepen=${inputs.fetchDepth}`,
|
||||
'origin',
|
||||
`+refs/heads/${sourceBranch}:refs/remotes/origin/${sourceBranch}`
|
||||
remoteName,
|
||||
`+refs/heads/${sourceBranch}:refs/remotes/${remoteName}/${sourceBranch}`
|
||||
]
|
||||
})
|
||||
} else {
|
||||
|
@ -128,13 +146,13 @@ export const getSHAForNonPullRequestEvent = async (
|
|||
'-u',
|
||||
'--progress',
|
||||
`--deepen=${inputs.fetchDepth}`,
|
||||
'origin',
|
||||
`+refs/heads/${targetBranch}:refs/remotes/origin/${targetBranch}`
|
||||
remoteName,
|
||||
`+refs/heads/${targetBranch}:refs/remotes/${remoteName}/${targetBranch}`
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
if (hasSubmodule) {
|
||||
if (diffSubmodule) {
|
||||
await gitFetchSubmodules({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
|
@ -146,7 +164,7 @@ export const getSHAForNonPullRequestEvent = async (
|
|||
})
|
||||
}
|
||||
} else {
|
||||
if (hasSubmodule && inputs.fetchSubmoduleHistory) {
|
||||
if (diffSubmodule && inputs.fetchAdditionalSubmoduleHistory) {
|
||||
await gitFetchSubmodules({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
|
@ -161,10 +179,24 @@ export const getSHAForNonPullRequestEvent = async (
|
|||
}
|
||||
|
||||
const currentSha = await getCurrentSHA({inputs, workingDirectory})
|
||||
let previousSha = inputs.baseSha
|
||||
let previousSha = await cleanShaInput({
|
||||
sha: inputs.baseSha,
|
||||
cwd: workingDirectory,
|
||||
token: inputs.token
|
||||
})
|
||||
const diff = '..'
|
||||
const currentBranchName = await getCurrentBranchName({cwd: workingDirectory})
|
||||
|
||||
if (previousSha && currentSha && currentBranch && targetBranch) {
|
||||
if (
|
||||
currentBranchName &&
|
||||
currentBranchName !== 'HEAD' &&
|
||||
(currentBranchName !== targetBranch || currentBranchName !== currentBranch)
|
||||
) {
|
||||
targetBranch = currentBranchName
|
||||
currentBranch = currentBranchName
|
||||
}
|
||||
|
||||
if (inputs.baseSha && inputs.sha && currentBranch && targetBranch) {
|
||||
if (previousSha === currentSha) {
|
||||
core.error(
|
||||
`Similar commit hashes detected: previous sha: ${previousSha} is equivalent to the current sha: ${currentSha}.`
|
||||
|
@ -175,7 +207,6 @@ export const getSHAForNonPullRequestEvent = async (
|
|||
throw new Error('Similar commit hashes detected.')
|
||||
}
|
||||
|
||||
await verifyCommitSha({sha: previousSha, cwd: workingDirectory})
|
||||
core.debug(`Previous SHA: ${previousSha}`)
|
||||
|
||||
return {
|
||||
|
@ -187,7 +218,7 @@ export const getSHAForNonPullRequestEvent = async (
|
|||
}
|
||||
}
|
||||
|
||||
if (!previousSha) {
|
||||
if (!previousSha || previousSha === currentSha) {
|
||||
core.debug('Getting previous SHA...')
|
||||
if (inputs.since) {
|
||||
core.debug(`Getting base SHA for '${inputs.since}'...`)
|
||||
|
@ -209,7 +240,12 @@ export const getSHAForNonPullRequestEvent = async (
|
|||
}
|
||||
} else if (isTag) {
|
||||
core.debug('Getting previous SHA for tag...')
|
||||
const {sha, tag} = await getPreviousGitTag({cwd: workingDirectory})
|
||||
const {sha, tag} = await getPreviousGitTag({
|
||||
cwd: workingDirectory,
|
||||
tagsPattern: inputs.tagsPattern,
|
||||
tagsIgnorePattern: inputs.tagsIgnorePattern,
|
||||
currentBranch
|
||||
})
|
||||
previousSha = sha
|
||||
targetBranch = tag
|
||||
} else {
|
||||
|
@ -288,14 +324,23 @@ export const getSHAForNonPullRequestEvent = async (
|
|||
}
|
||||
}
|
||||
|
||||
export const getSHAForPullRequestEvent = async (
|
||||
inputs: Inputs,
|
||||
env: Env,
|
||||
workingDirectory: string,
|
||||
isShallow: boolean,
|
||||
hasSubmodule: boolean,
|
||||
interface SHAForPullRequestEvent {
|
||||
inputs: Inputs
|
||||
workingDirectory: string
|
||||
isShallow: boolean
|
||||
diffSubmodule: boolean
|
||||
gitFetchExtraArgs: string[]
|
||||
): Promise<DiffResult> => {
|
||||
remoteName: string
|
||||
}
|
||||
|
||||
export const getSHAForPullRequestEvent = async ({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
isShallow,
|
||||
diffSubmodule,
|
||||
gitFetchExtraArgs,
|
||||
remoteName
|
||||
}: SHAForPullRequestEvent): Promise<DiffResult> => {
|
||||
let targetBranch = github.context.payload.pull_request?.base?.ref
|
||||
const currentBranch = github.context.payload.pull_request?.head?.ref
|
||||
if (inputs.sinceLastRemoteCommit) {
|
||||
|
@ -311,7 +356,7 @@ export const getSHAForPullRequestEvent = async (
|
|||
...gitFetchExtraArgs,
|
||||
'-u',
|
||||
'--progress',
|
||||
'origin',
|
||||
remoteName,
|
||||
`pull/${github.context.payload.pull_request?.number}/head:${currentBranch}`
|
||||
]
|
||||
})
|
||||
|
@ -324,8 +369,8 @@ export const getSHAForPullRequestEvent = async (
|
|||
'-u',
|
||||
'--progress',
|
||||
`--deepen=${inputs.fetchDepth}`,
|
||||
'origin',
|
||||
`+refs/heads/${currentBranch}*:refs/remotes/origin/${currentBranch}*`
|
||||
remoteName,
|
||||
`+refs/heads/${currentBranch}*:refs/remotes/${remoteName}/${currentBranch}*`
|
||||
]
|
||||
})
|
||||
}
|
||||
|
@ -335,35 +380,32 @@ export const getSHAForPullRequestEvent = async (
|
|||
'Failed to fetch pull request branch. Please ensure "persist-credentials" is set to "true" when checking out the repository. See: https://github.com/actions/checkout#usage'
|
||||
)
|
||||
}
|
||||
core.debug('Fetching target branch...')
|
||||
await gitFetch({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
...gitFetchExtraArgs,
|
||||
'-u',
|
||||
'--progress',
|
||||
`--deepen=${inputs.fetchDepth}`,
|
||||
remoteName,
|
||||
`+refs/heads/${github.context.payload.pull_request?.base?.ref}:refs/remotes/${remoteName}/${github.context.payload.pull_request?.base?.ref}`
|
||||
]
|
||||
})
|
||||
|
||||
if (!inputs.sinceLastRemoteCommit) {
|
||||
core.debug('Fetching target branch...')
|
||||
await gitFetch({
|
||||
if (diffSubmodule) {
|
||||
await gitFetchSubmodules({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
...gitFetchExtraArgs,
|
||||
'-u',
|
||||
'--progress',
|
||||
`--deepen=${inputs.fetchDepth}`,
|
||||
'origin',
|
||||
`+refs/heads/${targetBranch}:refs/remotes/origin/${targetBranch}`
|
||||
`--deepen=${inputs.fetchDepth}`
|
||||
]
|
||||
})
|
||||
|
||||
if (hasSubmodule) {
|
||||
await gitFetchSubmodules({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
...gitFetchExtraArgs,
|
||||
'-u',
|
||||
'--progress',
|
||||
`--deepen=${inputs.fetchDepth}`
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (hasSubmodule && inputs.fetchSubmoduleHistory) {
|
||||
if (diffSubmodule && inputs.fetchAdditionalSubmoduleHistory) {
|
||||
await gitFetchSubmodules({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
|
@ -379,10 +421,14 @@ export const getSHAForPullRequestEvent = async (
|
|||
}
|
||||
|
||||
const currentSha = await getCurrentSHA({inputs, workingDirectory})
|
||||
let previousSha = inputs.baseSha
|
||||
let previousSha = await cleanShaInput({
|
||||
sha: inputs.baseSha,
|
||||
cwd: workingDirectory,
|
||||
token: inputs.token
|
||||
})
|
||||
let diff = '...'
|
||||
|
||||
if (previousSha && currentSha && currentBranch && targetBranch) {
|
||||
if (inputs.baseSha && inputs.sha && currentBranch && targetBranch) {
|
||||
if (previousSha === currentSha) {
|
||||
core.error(
|
||||
`Similar commit hashes detected: previous sha: ${previousSha} is equivalent to the current sha: ${currentSha}.`
|
||||
|
@ -393,7 +439,6 @@ export const getSHAForPullRequestEvent = async (
|
|||
throw new Error('Similar commit hashes detected.')
|
||||
}
|
||||
|
||||
await verifyCommitSha({sha: previousSha, cwd: workingDirectory})
|
||||
core.debug(`Previous SHA: ${previousSha}`)
|
||||
|
||||
return {
|
||||
|
@ -405,45 +450,71 @@ export const getSHAForPullRequestEvent = async (
|
|||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!github.context.payload.pull_request?.base?.ref ||
|
||||
github.context.payload.head?.repo?.fork === 'true'
|
||||
) {
|
||||
if (!github.context.payload.pull_request?.base?.ref) {
|
||||
diff = '..'
|
||||
}
|
||||
|
||||
if (!previousSha) {
|
||||
if (!previousSha || previousSha === currentSha) {
|
||||
if (inputs.sinceLastRemoteCommit) {
|
||||
previousSha = github.context.payload.before
|
||||
|
||||
if (
|
||||
!previousSha ||
|
||||
(previousSha &&
|
||||
(await verifyCommitSha({sha: previousSha, cwd: workingDirectory})) !==
|
||||
0)
|
||||
(await verifyCommitSha({
|
||||
sha: previousSha,
|
||||
cwd: workingDirectory,
|
||||
showAsErrorMessage: false
|
||||
})) !== 0)
|
||||
) {
|
||||
core.warning(
|
||||
'Unable to locate the remote branch head sha. Falling back to the previous commit in the local history.'
|
||||
core.info(
|
||||
`Unable to locate the previous commit in the local history for ${github.context.eventName} (${github.context.payload.action}) event. Falling back to the previous commit in the local history.`
|
||||
)
|
||||
|
||||
previousSha = await getParentSha({
|
||||
cwd: workingDirectory
|
||||
})
|
||||
|
||||
if (!previousSha) {
|
||||
core.warning(
|
||||
'Unable to locate the previous commit in the local history. Falling back to the pull request base sha.'
|
||||
if (
|
||||
github.context.payload.action &&
|
||||
github.context.payload.action === 'synchronize' &&
|
||||
previousSha &&
|
||||
(!previousSha ||
|
||||
(previousSha &&
|
||||
(await verifyCommitSha({
|
||||
sha: previousSha,
|
||||
cwd: workingDirectory,
|
||||
showAsErrorMessage: false
|
||||
})) !== 0))
|
||||
) {
|
||||
throw new Error(
|
||||
'Unable to locate the previous commit in the local history. Please ensure to checkout pull request HEAD commit instead of the merge commit. See: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit'
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
!previousSha ||
|
||||
(previousSha &&
|
||||
(await verifyCommitSha({
|
||||
sha: previousSha,
|
||||
cwd: workingDirectory,
|
||||
showAsErrorMessage: false
|
||||
})) !== 0)
|
||||
) {
|
||||
throw new Error(
|
||||
'Unable to locate the previous commit in the local history. Please ensure to checkout pull request HEAD commit instead of the merge commit. See: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit'
|
||||
)
|
||||
previousSha = github.context.payload.pull_request?.base?.sha
|
||||
}
|
||||
}
|
||||
} else {
|
||||
previousSha = await getRemoteBranchHeadSha({
|
||||
cwd: workingDirectory,
|
||||
branch: targetBranch
|
||||
})
|
||||
previousSha = github.context.payload.pull_request?.base?.sha
|
||||
|
||||
if (!previousSha) {
|
||||
previousSha = github.context.payload.pull_request?.base?.sha
|
||||
previousSha = await getRemoteBranchHeadSha({
|
||||
cwd: workingDirectory,
|
||||
remoteName,
|
||||
branch: targetBranch
|
||||
})
|
||||
}
|
||||
|
||||
if (isShallow) {
|
||||
|
@ -459,7 +530,11 @@ export const getSHAForPullRequestEvent = async (
|
|||
'Merge base is not in the local history, fetching remote target branch...'
|
||||
)
|
||||
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
for (
|
||||
let i = 1;
|
||||
i <= (inputs.fetchMissingHistoryMaxRetries || 10);
|
||||
i++
|
||||
) {
|
||||
await gitFetch({
|
||||
cwd: workingDirectory,
|
||||
args: [
|
||||
|
@ -467,8 +542,8 @@ export const getSHAForPullRequestEvent = async (
|
|||
'-u',
|
||||
'--progress',
|
||||
`--deepen=${inputs.fetchDepth}`,
|
||||
'origin',
|
||||
`+refs/heads/${targetBranch}:refs/remotes/origin/${targetBranch}`
|
||||
remoteName,
|
||||
`+refs/heads/${targetBranch}:refs/remotes/${remoteName}/${targetBranch}`
|
||||
]
|
||||
})
|
||||
|
||||
|
@ -486,7 +561,9 @@ export const getSHAForPullRequestEvent = async (
|
|||
core.info(
|
||||
'Merge base is not in the local history, fetching remote target branch again...'
|
||||
)
|
||||
core.info(`Attempt ${i}/10`)
|
||||
core.info(
|
||||
`Attempt ${i}/${inputs.fetchMissingHistoryMaxRetries || 10}`
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -519,6 +596,12 @@ export const getSHAForPullRequestEvent = async (
|
|||
diff
|
||||
}))
|
||||
) {
|
||||
core.warning(
|
||||
'If this pull request is from a forked repository, please set the checkout action `repository` input to the same repository as the pull request.'
|
||||
)
|
||||
core.warning(
|
||||
'This can be done by setting actions/checkout `repository` to ${{ github.event.pull_request.head.repo.full_name }}'
|
||||
)
|
||||
throw new Error(
|
||||
`Unable to determine a difference between ${previousSha}${diff}${currentSha}`
|
||||
)
|
||||
|
|
29
src/constant.ts
Normal file
29
src/constant.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import {Inputs} from './inputs'
|
||||
|
||||
export const DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS: Partial<Inputs> = {
|
||||
sha: '',
|
||||
baseSha: '',
|
||||
since: '',
|
||||
until: '',
|
||||
path: '.',
|
||||
quotepath: true,
|
||||
diffRelative: true,
|
||||
sinceLastRemoteCommit: false,
|
||||
recoverDeletedFiles: false,
|
||||
recoverDeletedFilesToDestination: '',
|
||||
recoverFiles: '',
|
||||
recoverFilesSeparator: '\n',
|
||||
recoverFilesIgnore: '',
|
||||
recoverFilesIgnoreSeparator: '\n',
|
||||
includeAllOldNewRenamedFiles: false,
|
||||
oldNewSeparator: ',',
|
||||
oldNewFilesSeparator: ' ',
|
||||
skipInitialFetch: false,
|
||||
fetchAdditionalSubmoduleHistory: false,
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false,
|
||||
excludeSubmodules: false,
|
||||
fetchMissingHistoryMaxRetries: 20,
|
||||
usePosixPathSeparator: false,
|
||||
tagsPattern: '*',
|
||||
tagsIgnorePattern: ''
|
||||
}
|
|
@ -1,13 +1,10 @@
|
|||
import * as core from '@actions/core'
|
||||
|
||||
export type Env = {
|
||||
GITHUB_REF_NAME: string
|
||||
GITHUB_REF: string
|
||||
GITHUB_WORKSPACE: string
|
||||
}
|
||||
export const getEnv = async (): Promise<Env> => {
|
||||
core.debug(`Process Env: ${JSON.stringify(process.env, null, 2)}`)
|
||||
|
||||
export const getEnv = async (): Promise<Env> => {
|
||||
return {
|
||||
GITHUB_REF_NAME: process.env.GITHUB_REF_NAME || '',
|
||||
GITHUB_REF: process.env.GITHUB_REF || '',
|
||||
|
|
110
src/inputs.ts
110
src/inputs.ts
|
@ -24,17 +24,19 @@ export type Inputs = {
|
|||
since: string
|
||||
until: string
|
||||
path: string
|
||||
quotePath: boolean
|
||||
quotepath: boolean
|
||||
diffRelative: boolean
|
||||
dirNames: boolean
|
||||
dirNamesMaxDepth?: number
|
||||
dirNamesExcludeCurrentDir: boolean
|
||||
dirNamesIncludeFiles: string
|
||||
dirNamesIncludeFilesSeparator: string
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: boolean
|
||||
json: boolean
|
||||
escapeJson: boolean
|
||||
safeOutput: boolean
|
||||
fetchDepth?: number
|
||||
fetchSubmoduleHistory: boolean
|
||||
fetchAdditionalSubmoduleHistory: boolean
|
||||
sinceLastRemoteCommit: boolean
|
||||
writeOutputFiles: boolean
|
||||
outputDir: string
|
||||
|
@ -48,6 +50,15 @@ export type Inputs = {
|
|||
token: string
|
||||
apiUrl: string
|
||||
skipInitialFetch: boolean
|
||||
failOnInitialDiffError: boolean
|
||||
failOnSubmoduleDiffError: boolean
|
||||
negationPatternsFirst: boolean
|
||||
useRestApi: boolean
|
||||
excludeSubmodules: boolean
|
||||
fetchMissingHistoryMaxRetries?: number
|
||||
usePosixPathSeparator: boolean
|
||||
tagsPattern: string
|
||||
tagsIgnorePattern?: string
|
||||
}
|
||||
|
||||
export const getInputs = (): Inputs => {
|
||||
|
@ -126,7 +137,7 @@ export const getInputs = (): Inputs => {
|
|||
const since = core.getInput('since', {required: false})
|
||||
const until = core.getInput('until', {required: false})
|
||||
const path = core.getInput('path', {required: false})
|
||||
const quotePath = core.getBooleanInput('quotepath', {required: false})
|
||||
const quotepath = core.getBooleanInput('quotepath', {required: false})
|
||||
const diffRelative = core.getBooleanInput('diff_relative', {required: false})
|
||||
const dirNames = core.getBooleanInput('dir_names', {required: false})
|
||||
const dirNamesMaxDepth = core.getInput('dir_names_max_depth', {
|
||||
|
@ -148,8 +159,16 @@ export const getInputs = (): Inputs => {
|
|||
trimWhitespace: false
|
||||
}
|
||||
)
|
||||
const json = core.getBooleanInput('json', {required: false})
|
||||
const escapeJson = core.getBooleanInput('escape_json', {required: false})
|
||||
let json = core.getBooleanInput('json', {required: false})
|
||||
let escapeJson = core.getBooleanInput('escape_json', {required: false})
|
||||
const matrix = core.getBooleanInput('matrix', {required: false})
|
||||
|
||||
if (matrix) {
|
||||
json = true
|
||||
escapeJson = false
|
||||
}
|
||||
|
||||
const safeOutput = core.getBooleanInput('safe_output', {required: false})
|
||||
const fetchDepth = core.getInput('fetch_depth', {required: false})
|
||||
const sinceLastRemoteCommit = core.getBooleanInput(
|
||||
'since_last_remote_commit',
|
||||
|
@ -190,12 +209,66 @@ export const getInputs = (): Inputs => {
|
|||
const skipInitialFetch = core.getBooleanInput('skip_initial_fetch', {
|
||||
required: false
|
||||
})
|
||||
const fetchSubmoduleHistory = core.getBooleanInput(
|
||||
const fetchAdditionalSubmoduleHistory = core.getBooleanInput(
|
||||
'fetch_additional_submodule_history',
|
||||
{
|
||||
required: false
|
||||
}
|
||||
)
|
||||
const failOnInitialDiffError = core.getBooleanInput(
|
||||
'fail_on_initial_diff_error',
|
||||
{
|
||||
required: false
|
||||
}
|
||||
)
|
||||
const failOnSubmoduleDiffError = core.getBooleanInput(
|
||||
'fail_on_submodule_diff_error',
|
||||
{
|
||||
required: false
|
||||
}
|
||||
)
|
||||
const dirNamesDeletedFilesIncludeOnlyDeletedDirs = core.getBooleanInput(
|
||||
'dir_names_deleted_files_include_only_deleted_dirs',
|
||||
{
|
||||
required: false
|
||||
}
|
||||
)
|
||||
|
||||
const negationPatternsFirst = core.getBooleanInput(
|
||||
'negation_patterns_first',
|
||||
{
|
||||
required: false
|
||||
}
|
||||
)
|
||||
|
||||
const useRestApi = core.getBooleanInput('use_rest_api', {
|
||||
required: false
|
||||
})
|
||||
|
||||
const excludeSubmodules = core.getBooleanInput('exclude_submodules', {
|
||||
required: false
|
||||
})
|
||||
|
||||
const fetchMissingHistoryMaxRetries = core.getInput(
|
||||
'fetch_missing_history_max_retries',
|
||||
{required: false}
|
||||
)
|
||||
|
||||
const usePosixPathSeparator = core.getBooleanInput(
|
||||
'use_posix_path_separator',
|
||||
{
|
||||
required: false
|
||||
}
|
||||
)
|
||||
|
||||
const tagsPattern = core.getInput('tags_pattern', {
|
||||
required: false,
|
||||
trimWhitespace: false
|
||||
})
|
||||
const tagsIgnorePattern = core.getInput('tags_ignore_pattern', {
|
||||
required: false,
|
||||
trimWhitespace: false
|
||||
})
|
||||
|
||||
const inputs: Inputs = {
|
||||
files,
|
||||
|
@ -212,6 +285,8 @@ export const getInputs = (): Inputs => {
|
|||
filesIgnoreYaml,
|
||||
filesIgnoreYamlFromSourceFile,
|
||||
filesIgnoreYamlFromSourceFileSeparator,
|
||||
failOnInitialDiffError,
|
||||
failOnSubmoduleDiffError,
|
||||
separator,
|
||||
// Not Supported via REST API
|
||||
sha,
|
||||
|
@ -219,7 +294,7 @@ export const getInputs = (): Inputs => {
|
|||
since,
|
||||
until,
|
||||
path,
|
||||
quotePath,
|
||||
quotepath,
|
||||
diffRelative,
|
||||
sinceLastRemoteCommit,
|
||||
recoverDeletedFiles,
|
||||
|
@ -232,7 +307,12 @@ export const getInputs = (): Inputs => {
|
|||
oldNewSeparator,
|
||||
oldNewFilesSeparator,
|
||||
skipInitialFetch,
|
||||
fetchSubmoduleHistory,
|
||||
fetchAdditionalSubmoduleHistory,
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs,
|
||||
excludeSubmodules,
|
||||
usePosixPathSeparator,
|
||||
tagsPattern,
|
||||
tagsIgnorePattern,
|
||||
// End Not Supported via REST API
|
||||
dirNames,
|
||||
dirNamesExcludeCurrentDir,
|
||||
|
@ -240,14 +320,18 @@ export const getInputs = (): Inputs => {
|
|||
dirNamesIncludeFilesSeparator,
|
||||
json,
|
||||
escapeJson,
|
||||
safeOutput,
|
||||
writeOutputFiles,
|
||||
outputDir,
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
token,
|
||||
apiUrl
|
||||
apiUrl,
|
||||
negationPatternsFirst,
|
||||
useRestApi
|
||||
}
|
||||
|
||||
if (fetchDepth) {
|
||||
// Fallback to at least 2 if the fetch_depth is less than 2
|
||||
inputs.fetchDepth = Math.max(parseInt(fetchDepth, 10), 2)
|
||||
}
|
||||
|
||||
|
@ -255,5 +339,13 @@ export const getInputs = (): Inputs => {
|
|||
inputs.dirNamesMaxDepth = parseInt(dirNamesMaxDepth, 10)
|
||||
}
|
||||
|
||||
if (fetchMissingHistoryMaxRetries) {
|
||||
// Fallback to at least 1 if the fetch_missing_history_max_retries is less than 1
|
||||
inputs.fetchMissingHistoryMaxRetries = Math.max(
|
||||
parseInt(fetchMissingHistoryMaxRetries, 10),
|
||||
1
|
||||
)
|
||||
}
|
||||
|
||||
return inputs
|
||||
}
|
||||
|
|
202
src/main.ts
202
src/main.ts
|
@ -2,13 +2,12 @@ import * as core from '@actions/core'
|
|||
import * as github from '@actions/github'
|
||||
import path from 'path'
|
||||
import {
|
||||
ChangedFiles,
|
||||
processChangedFiles,
|
||||
ChangeTypeEnum,
|
||||
getAllDiffFiles,
|
||||
getChangedFilesFromGithubAPI,
|
||||
getRenamedFiles
|
||||
} from './changedFiles'
|
||||
import {setChangedFilesOutput} from './changedFilesOutput'
|
||||
import {
|
||||
DiffResult,
|
||||
getSHAForNonPullRequestEvent,
|
||||
|
@ -18,7 +17,6 @@ import {Env, getEnv} from './env'
|
|||
import {getInputs, Inputs} from './inputs'
|
||||
import {
|
||||
getFilePatterns,
|
||||
getFilteredChangedFiles,
|
||||
getRecoverFilePatterns,
|
||||
getSubmodulePath,
|
||||
getYamlFilePatterns,
|
||||
|
@ -28,76 +26,11 @@ import {
|
|||
setOutput,
|
||||
submoduleExists,
|
||||
updateGitGlobalConfig,
|
||||
verifyMinimumGitVersion
|
||||
verifyMinimumGitVersion,
|
||||
warnUnsupportedRESTAPIInputs
|
||||
} from './utils'
|
||||
|
||||
const changedFilesOutput = async ({
|
||||
filePatterns,
|
||||
allDiffFiles,
|
||||
inputs,
|
||||
yamlFilePatterns
|
||||
}: {
|
||||
filePatterns: string[]
|
||||
allDiffFiles: ChangedFiles
|
||||
inputs: Inputs
|
||||
yamlFilePatterns: Record<string, string[]>
|
||||
}): Promise<void> => {
|
||||
if (filePatterns.length > 0) {
|
||||
core.startGroup('changed-files-patterns')
|
||||
const allFilteredDiffFiles = await getFilteredChangedFiles({
|
||||
allDiffFiles,
|
||||
filePatterns
|
||||
})
|
||||
core.debug(
|
||||
`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`
|
||||
)
|
||||
await setChangedFilesOutput({
|
||||
allDiffFiles,
|
||||
allFilteredDiffFiles,
|
||||
inputs,
|
||||
filePatterns
|
||||
})
|
||||
core.info('All Done!')
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
if (Object.keys(yamlFilePatterns).length > 0) {
|
||||
for (const key of Object.keys(yamlFilePatterns)) {
|
||||
core.startGroup(`changed-files-yaml-${key}`)
|
||||
const allFilteredDiffFiles = await getFilteredChangedFiles({
|
||||
allDiffFiles,
|
||||
filePatterns: yamlFilePatterns[key]
|
||||
})
|
||||
core.debug(
|
||||
`All filtered diff files for ${key}: ${JSON.stringify(
|
||||
allFilteredDiffFiles
|
||||
)}`
|
||||
)
|
||||
await setChangedFilesOutput({
|
||||
allDiffFiles,
|
||||
allFilteredDiffFiles,
|
||||
inputs,
|
||||
filePatterns: yamlFilePatterns[key],
|
||||
outputPrefix: key
|
||||
})
|
||||
core.info('All Done!')
|
||||
core.endGroup()
|
||||
}
|
||||
}
|
||||
|
||||
if (filePatterns.length === 0 && Object.keys(yamlFilePatterns).length === 0) {
|
||||
core.startGroup('changed-files-all')
|
||||
await setChangedFilesOutput({
|
||||
allDiffFiles,
|
||||
allFilteredDiffFiles: allDiffFiles,
|
||||
inputs
|
||||
})
|
||||
core.info('All Done!')
|
||||
core.endGroup()
|
||||
}
|
||||
}
|
||||
|
||||
const getChangedFilesFromLocalGit = async ({
|
||||
const getChangedFilesFromLocalGitHistory = async ({
|
||||
inputs,
|
||||
env,
|
||||
workingDirectory,
|
||||
|
@ -112,15 +45,15 @@ const getChangedFilesFromLocalGit = async ({
|
|||
}): Promise<void> => {
|
||||
await verifyMinimumGitVersion()
|
||||
|
||||
let quotePathValue = 'on'
|
||||
let quotepathValue = 'on'
|
||||
|
||||
if (!inputs.quotePath) {
|
||||
quotePathValue = 'off'
|
||||
if (!inputs.quotepath) {
|
||||
quotepathValue = 'off'
|
||||
}
|
||||
|
||||
await updateGitGlobalConfig({
|
||||
name: 'core.quotepath',
|
||||
value: quotePathValue
|
||||
value: quotepathValue
|
||||
})
|
||||
|
||||
if (inputs.diffRelative) {
|
||||
|
@ -131,14 +64,26 @@ const getChangedFilesFromLocalGit = async ({
|
|||
}
|
||||
|
||||
const isShallow = await isRepoShallow({cwd: workingDirectory})
|
||||
const hasSubmodule = await submoduleExists({cwd: workingDirectory})
|
||||
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules']
|
||||
let diffSubmodule = false
|
||||
let gitFetchExtraArgs = ['--no-tags', '--prune']
|
||||
|
||||
if (inputs.excludeSubmodules) {
|
||||
core.info('Excluding submodules from the diff')
|
||||
} else {
|
||||
diffSubmodule = await submoduleExists({cwd: workingDirectory})
|
||||
}
|
||||
|
||||
if (diffSubmodule) {
|
||||
gitFetchExtraArgs.push('--recurse-submodules')
|
||||
}
|
||||
|
||||
const isTag = env.GITHUB_REF?.startsWith('refs/tags/')
|
||||
const remoteName = 'origin'
|
||||
const outputRenamedFilesAsDeletedAndAdded =
|
||||
inputs.outputRenamedFilesAsDeletedAndAdded
|
||||
let submodulePaths: string[] = []
|
||||
|
||||
if (hasSubmodule) {
|
||||
if (diffSubmodule) {
|
||||
submodulePaths = await getSubmodulePath({cwd: workingDirectory})
|
||||
}
|
||||
|
||||
|
@ -150,29 +95,30 @@ const getChangedFilesFromLocalGit = async ({
|
|||
|
||||
if (!github.context.payload.pull_request?.base?.ref) {
|
||||
core.info(`Running on a ${github.context.eventName || 'push'} event...`)
|
||||
diffResult = await getSHAForNonPullRequestEvent(
|
||||
diffResult = await getSHAForNonPullRequestEvent({
|
||||
inputs,
|
||||
env,
|
||||
workingDirectory,
|
||||
isShallow,
|
||||
hasSubmodule,
|
||||
diffSubmodule,
|
||||
gitFetchExtraArgs,
|
||||
isTag
|
||||
)
|
||||
isTag,
|
||||
remoteName
|
||||
})
|
||||
} else {
|
||||
core.info(
|
||||
`Running on a ${github.context.eventName || 'pull_request'} (${
|
||||
github.context.payload.action
|
||||
}) event...`
|
||||
)
|
||||
diffResult = await getSHAForPullRequestEvent(
|
||||
diffResult = await getSHAForPullRequestEvent({
|
||||
inputs,
|
||||
env,
|
||||
workingDirectory,
|
||||
isShallow,
|
||||
hasSubmodule,
|
||||
gitFetchExtraArgs
|
||||
)
|
||||
diffSubmodule,
|
||||
gitFetchExtraArgs,
|
||||
remoteName
|
||||
})
|
||||
}
|
||||
|
||||
if (diffResult.initialCommit) {
|
||||
|
@ -187,11 +133,13 @@ const getChangedFilesFromLocalGit = async ({
|
|||
|
||||
const allDiffFiles = await getAllDiffFiles({
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffSubmodule,
|
||||
diffResult,
|
||||
submodulePaths,
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
fetchSubmoduleHistory: inputs.fetchSubmoduleHistory
|
||||
fetchAdditionalSubmoduleHistory: inputs.fetchAdditionalSubmoduleHistory,
|
||||
failOnInitialDiffError: inputs.failOnInitialDiffError,
|
||||
failOnSubmoduleDiffError: inputs.failOnSubmoduleDiffError
|
||||
})
|
||||
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`)
|
||||
core.info('All Done!')
|
||||
|
@ -210,15 +158,18 @@ const getChangedFilesFromLocalGit = async ({
|
|||
workingDirectory,
|
||||
deletedFiles: allDiffFiles[ChangeTypeEnum.Deleted],
|
||||
recoverPatterns,
|
||||
sha: diffResult.previousSha
|
||||
diffResult,
|
||||
diffSubmodule,
|
||||
submodulePaths
|
||||
})
|
||||
}
|
||||
|
||||
await changedFilesOutput({
|
||||
await processChangedFiles({
|
||||
filePatterns,
|
||||
allDiffFiles,
|
||||
inputs,
|
||||
yamlFilePatterns
|
||||
yamlFilePatterns,
|
||||
workingDirectory
|
||||
})
|
||||
|
||||
if (inputs.includeAllOldNewRenamedFiles) {
|
||||
|
@ -226,7 +177,7 @@ const getChangedFilesFromLocalGit = async ({
|
|||
const allOldNewRenamedFiles = await getRenamedFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffSubmodule,
|
||||
diffResult,
|
||||
submodulePaths
|
||||
})
|
||||
|
@ -234,12 +185,17 @@ const getChangedFilesFromLocalGit = async ({
|
|||
await setOutput({
|
||||
key: 'all_old_new_renamed_files',
|
||||
value: allOldNewRenamedFiles.paths,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
await setOutput({
|
||||
key: 'all_old_new_renamed_files_count',
|
||||
value: allOldNewRenamedFiles.count,
|
||||
inputs
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
})
|
||||
core.info('All Done!')
|
||||
core.endGroup()
|
||||
|
@ -261,7 +217,7 @@ const getChangedFilesFromRESTAPI = async ({
|
|||
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`)
|
||||
core.info('All Done!')
|
||||
|
||||
await changedFilesOutput({
|
||||
await processChangedFiles({
|
||||
filePatterns,
|
||||
allDiffFiles,
|
||||
inputs,
|
||||
|
@ -278,11 +234,9 @@ export async function run(): Promise<void> {
|
|||
const inputs = getInputs()
|
||||
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`)
|
||||
|
||||
core.debug(`Github Context: ${JSON.stringify(github.context, null, 2)}`)
|
||||
|
||||
const workingDirectory = path.resolve(
|
||||
env.GITHUB_WORKSPACE || process.cwd(),
|
||||
inputs.path
|
||||
inputs.useRestApi ? '.' : inputs.path
|
||||
)
|
||||
core.debug(`Working directory: ${workingDirectory}`)
|
||||
|
||||
|
@ -301,34 +255,19 @@ export async function run(): Promise<void> {
|
|||
})
|
||||
core.debug(`Yaml file patterns: ${JSON.stringify(yamlFilePatterns)}`)
|
||||
|
||||
if (inputs.useRestApi && !github.context.payload.pull_request?.number) {
|
||||
throw new Error(
|
||||
"Only pull_request* events are supported when using GitHub's REST API."
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
inputs.token &&
|
||||
github.context.payload.pull_request?.number &&
|
||||
!hasGitDirectory
|
||||
(!hasGitDirectory || inputs.useRestApi)
|
||||
) {
|
||||
core.info("Using GitHub's REST API to get changed files")
|
||||
const unsupportedInputs: (keyof Inputs)[] = [
|
||||
'sha',
|
||||
'baseSha',
|
||||
'since',
|
||||
'until',
|
||||
'sinceLastRemoteCommit',
|
||||
'recoverDeletedFiles',
|
||||
'recoverDeletedFilesToDestination',
|
||||
'recoverFiles',
|
||||
'recoverFilesIgnore',
|
||||
'includeAllOldNewRenamedFiles',
|
||||
'skipInitialFetch',
|
||||
'fetchSubmoduleHistory'
|
||||
]
|
||||
|
||||
for (const input of unsupportedInputs) {
|
||||
if (inputs[input]) {
|
||||
core.warning(
|
||||
`Input "${input}" is not supported when using GitHub's REST API to get changed files`
|
||||
)
|
||||
}
|
||||
}
|
||||
await warnUnsupportedRESTAPIInputs({inputs})
|
||||
await getChangedFilesFromRESTAPI({
|
||||
inputs,
|
||||
filePatterns,
|
||||
|
@ -336,14 +275,13 @@ export async function run(): Promise<void> {
|
|||
})
|
||||
} else {
|
||||
if (!hasGitDirectory) {
|
||||
core.setFailed(
|
||||
"Can't find local .git directory. Please run actions/checkout before this action"
|
||||
throw new Error(
|
||||
`Unable to locate the git repository in the given path: ${workingDirectory}.\n Please run actions/checkout before this action (Make sure the 'path' input is correct).\n If you intend to use Github's REST API note that only pull_request* events are supported. Current event is "${github.context.eventName}".`
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
core.info('Using local .git directory')
|
||||
await getChangedFilesFromLocalGit({
|
||||
await getChangedFilesFromLocalGitHistory({
|
||||
inputs,
|
||||
env,
|
||||
workingDirectory,
|
||||
|
@ -353,10 +291,8 @@ export async function run(): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (!process.env.TESTING) {
|
||||
// eslint-disable-next-line github/no-then
|
||||
run().catch(e => {
|
||||
core.setFailed(e.message || e)
|
||||
})
|
||||
}
|
||||
// eslint-disable-next-line github/no-then
|
||||
run().catch(e => {
|
||||
core.setFailed(e.message || e)
|
||||
process.exit(1)
|
||||
})
|
||||
|
|
486
src/utils.ts
486
src/utils.ts
|
@ -1,15 +1,16 @@
|
|||
/*global AsyncIterableIterator*/
|
||||
import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import * as github from '@actions/github'
|
||||
import {createReadStream, promises as fs} from 'fs'
|
||||
import {readFile} from 'fs/promises'
|
||||
import {flattenDeep} from 'lodash'
|
||||
import {flattenDeep, snakeCase} from 'lodash'
|
||||
import mm from 'micromatch'
|
||||
import * as path from 'path'
|
||||
import {createInterface} from 'readline'
|
||||
import {parseDocument} from 'yaml'
|
||||
import {ChangedFiles, ChangeTypeEnum} from './changedFiles'
|
||||
|
||||
import {DiffResult} from './commitSha'
|
||||
import {DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS} from './constant'
|
||||
import {Inputs} from './inputs'
|
||||
|
||||
const MINIMUM_GIT_VERSION = '2.18.0'
|
||||
|
@ -31,11 +32,13 @@ export const normalizeSeparators = (p: string): string => {
|
|||
|
||||
// Remove redundant slashes
|
||||
const isUnc = /^\\\\+[^\\]/.test(p) // e.g. \\hello
|
||||
return (isUnc ? '\\' : '') + p.replace(/\\\\+/g, '\\') // preserve leading \\ for UNC
|
||||
p = (isUnc ? '\\' : '') + p.replace(/\\\\+/g, '\\') // preserve leading \\ for UNC
|
||||
} else {
|
||||
// Remove redundant slashes on Linux/macOS
|
||||
p = p.replace(/\/\/+/g, '/')
|
||||
}
|
||||
|
||||
// Remove redundant slashes
|
||||
return p.replace(/\/\/+/g, '/')
|
||||
return p
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +143,7 @@ export const verifyMinimumGitVersion = async (): Promise<void> => {
|
|||
* @param filePath - path to check
|
||||
* @returns path exists
|
||||
*/
|
||||
const exists = async (filePath: string): Promise<boolean> => {
|
||||
export const exists = async (filePath: string): Promise<boolean> => {
|
||||
try {
|
||||
await fs.access(filePath)
|
||||
return true
|
||||
|
@ -170,15 +173,16 @@ async function* lineOfFileGenerator({
|
|||
input: fileStream,
|
||||
crlfDelay: Infinity
|
||||
})
|
||||
for await (const line of rl) {
|
||||
for await (let line of rl) {
|
||||
if (!line.startsWith('#') && line !== '') {
|
||||
if (excludedFiles) {
|
||||
if (line.startsWith('!')) {
|
||||
yield line
|
||||
} else {
|
||||
yield `!${line}`
|
||||
line = line.startsWith('!') ? line : `!${line}`
|
||||
if (line.endsWith(path.sep)) {
|
||||
line = `${line}**`
|
||||
}
|
||||
yield line
|
||||
} else {
|
||||
line = line.endsWith(path.sep) ? `${line}**` : line
|
||||
yield line
|
||||
}
|
||||
}
|
||||
|
@ -284,6 +288,7 @@ export const submoduleExists = async ({
|
|||
* Fetches the git repository
|
||||
* @param args - arguments for fetch command
|
||||
* @param cwd - working directory
|
||||
* @returns exit code
|
||||
*/
|
||||
export const gitFetch = async ({
|
||||
args,
|
||||
|
@ -332,6 +337,7 @@ export const gitFetchSubmodules = async ({
|
|||
/**
|
||||
* Retrieves all the submodule paths
|
||||
* @param cwd - working directory
|
||||
* @returns submodule paths
|
||||
*/
|
||||
export const getSubmodulePath = async ({
|
||||
cwd
|
||||
|
@ -366,6 +372,7 @@ export const getSubmodulePath = async ({
|
|||
* @param parentSha2 - parent commit sha
|
||||
* @param submodulePath - path of submodule
|
||||
* @param diff - diff type between parent commits (`..` or `...`)
|
||||
* @returns commit sha of submodule
|
||||
*/
|
||||
export const gitSubmoduleDiffSHA = async ({
|
||||
cwd,
|
||||
|
@ -490,6 +497,8 @@ export const gitRenamedFiles = async ({
|
|||
* @param isSubmodule - is the repo a submodule
|
||||
* @param parentDir - parent directory of the submodule
|
||||
* @param outputRenamedFilesAsDeletedAndAdded - output renamed files as deleted and added
|
||||
* @param failOnInitialDiffError - fail if the initial diff fails
|
||||
* @param failOnSubmoduleDiffError - fail if the submodule diff fails
|
||||
*/
|
||||
export const getAllChangedFiles = async ({
|
||||
cwd,
|
||||
|
@ -498,7 +507,9 @@ export const getAllChangedFiles = async ({
|
|||
diff,
|
||||
isSubmodule = false,
|
||||
parentDir = '',
|
||||
outputRenamedFilesAsDeletedAndAdded = false
|
||||
outputRenamedFilesAsDeletedAndAdded = false,
|
||||
failOnInitialDiffError = false,
|
||||
failOnSubmoduleDiffError = false
|
||||
}: {
|
||||
cwd: string
|
||||
sha1: string
|
||||
|
@ -507,6 +518,8 @@ export const getAllChangedFiles = async ({
|
|||
isSubmodule?: boolean
|
||||
parentDir?: string
|
||||
outputRenamedFilesAsDeletedAndAdded?: boolean
|
||||
failOnInitialDiffError?: boolean
|
||||
failOnSubmoduleDiffError?: boolean
|
||||
}): Promise<ChangedFiles> => {
|
||||
const {exitCode, stdout, stderr} = await exec.getExecOutput(
|
||||
'git',
|
||||
|
@ -534,6 +547,18 @@ export const getAllChangedFiles = async ({
|
|||
[ChangeTypeEnum.Unknown]: []
|
||||
}
|
||||
|
||||
if (exitCode !== 0) {
|
||||
if (failOnInitialDiffError && !isSubmodule) {
|
||||
throw new Error(
|
||||
`Failed to get changed files between: ${sha1}${diff}${sha2}: ${stderr}`
|
||||
)
|
||||
} else if (failOnSubmoduleDiffError && isSubmodule) {
|
||||
throw new Error(
|
||||
`Failed to get changed files for submodule between: ${sha1}${diff}${sha2}: ${stderr}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (exitCode !== 0) {
|
||||
if (isSubmodule) {
|
||||
core.warning(
|
||||
|
@ -662,14 +687,16 @@ export const isInsideWorkTree = async ({
|
|||
|
||||
export const getRemoteBranchHeadSha = async ({
|
||||
cwd,
|
||||
branch
|
||||
branch,
|
||||
remoteName
|
||||
}: {
|
||||
cwd: string
|
||||
branch: string
|
||||
remoteName: string
|
||||
}): Promise<string> => {
|
||||
const {stdout} = await exec.getExecOutput(
|
||||
'git',
|
||||
['rev-parse', `origin/${branch}`],
|
||||
['rev-parse', `${remoteName}/${branch}`],
|
||||
{
|
||||
cwd,
|
||||
silent: !core.isDebug()
|
||||
|
@ -679,6 +706,28 @@ export const getRemoteBranchHeadSha = async ({
|
|||
return stdout.trim()
|
||||
}
|
||||
|
||||
export const getCurrentBranchName = async ({
|
||||
cwd
|
||||
}: {
|
||||
cwd: string
|
||||
}): Promise<string> => {
|
||||
const {stdout, exitCode} = await exec.getExecOutput(
|
||||
'git',
|
||||
['rev-parse', '--abbrev-ref', 'HEAD'],
|
||||
{
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
silent: !core.isDebug()
|
||||
}
|
||||
)
|
||||
|
||||
if (exitCode !== 0) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return stdout.trim()
|
||||
}
|
||||
|
||||
export const getParentSha = async ({cwd}: {cwd: string}): Promise<string> => {
|
||||
const {stdout, exitCode} = await exec.getExecOutput(
|
||||
'git',
|
||||
|
@ -732,41 +781,130 @@ export const verifyCommitSha = async ({
|
|||
return exitCode
|
||||
}
|
||||
|
||||
export const getPreviousGitTag = async ({
|
||||
cwd
|
||||
/**
|
||||
* Clean the sha from the input which could be a branch name or a commit sha.
|
||||
*
|
||||
* If the input is a valid commit sha, return it as is.
|
||||
*
|
||||
* If the input is a branch name, get the HEAD sha of that branch and return it.
|
||||
*
|
||||
* @param sha The input string, which could be a branch name or a commit sha.
|
||||
* @param cwd The working directory.
|
||||
* @param token The GitHub token.
|
||||
* @returns The cleaned SHA string.
|
||||
*/
|
||||
export const cleanShaInput = async ({
|
||||
sha,
|
||||
cwd,
|
||||
token
|
||||
}: {
|
||||
sha: string
|
||||
cwd: string
|
||||
}): Promise<{tag: string; sha: string}> => {
|
||||
const {stdout} = await exec.getExecOutput(
|
||||
token: string
|
||||
}): Promise<string> => {
|
||||
// Check if the input is a valid commit sha
|
||||
if (!sha) {
|
||||
return sha
|
||||
}
|
||||
// Check if the input is a valid commit sha
|
||||
const {stdout, exitCode} = await exec.getExecOutput(
|
||||
'git',
|
||||
['tag', '--sort=-creatordate'],
|
||||
['rev-parse', '--verify', `${sha}^{commit}`],
|
||||
{
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
silent: !core.isDebug()
|
||||
}
|
||||
)
|
||||
|
||||
const tags = stdout.trim().split('\n')
|
||||
if (exitCode !== 0) {
|
||||
const octokit = github.getOctokit(token)
|
||||
// If it's not a valid commit sha, assume it's a branch name and get the HEAD sha
|
||||
const {data: refData} = await octokit.rest.git.getRef({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
ref: `heads/${sha}`
|
||||
})
|
||||
|
||||
if (tags.length < 2) {
|
||||
core.warning('No previous tag found')
|
||||
return {tag: '', sha: ''}
|
||||
return refData.object.sha
|
||||
}
|
||||
|
||||
const previousTag = tags[1]
|
||||
return stdout.trim()
|
||||
}
|
||||
|
||||
const {stdout: stdout2} = await exec.getExecOutput(
|
||||
export const getPreviousGitTag = async ({
|
||||
cwd,
|
||||
tagsPattern,
|
||||
currentBranch,
|
||||
tagsIgnorePattern
|
||||
}: {
|
||||
cwd: string
|
||||
tagsPattern: string
|
||||
currentBranch: string
|
||||
tagsIgnorePattern?: string
|
||||
}): Promise<{tag: string; sha: string}> => {
|
||||
const ignorePatterns: string[] = []
|
||||
let currentShaDate: Date | null = null
|
||||
|
||||
const {stdout} = await exec.getExecOutput(
|
||||
'git',
|
||||
['rev-parse', previousTag],
|
||||
[
|
||||
'tag',
|
||||
'--sort=-creatordate',
|
||||
'--format=%(refname:short)|%(objectname)|%(creatordate:iso)'
|
||||
],
|
||||
{
|
||||
cwd,
|
||||
silent: !core.isDebug()
|
||||
}
|
||||
)
|
||||
|
||||
const sha = stdout2.trim()
|
||||
if (tagsIgnorePattern) {
|
||||
ignorePatterns.push(tagsIgnorePattern)
|
||||
}
|
||||
|
||||
return {tag: previousTag, sha}
|
||||
if (currentBranch) {
|
||||
ignorePatterns.push(currentBranch)
|
||||
try {
|
||||
const {stdout: currentShaDateOutput} = await exec.getExecOutput(
|
||||
'git',
|
||||
['show', '-s', '--format=%ai', currentBranch],
|
||||
{
|
||||
cwd,
|
||||
silent: !core.isDebug()
|
||||
}
|
||||
)
|
||||
currentShaDate = new Date(currentShaDateOutput.trim())
|
||||
} catch (error) {
|
||||
// Handle the case where the current branch doesn't exist
|
||||
// This might happen in detached head state
|
||||
core.warning(`Failed to get date for current branch ${currentBranch}`)
|
||||
}
|
||||
}
|
||||
|
||||
const previousTag: {tag: string; sha: string} = {tag: '', sha: ''}
|
||||
|
||||
const tags = stdout.trim().split('\n')
|
||||
for (const tagData of tags) {
|
||||
const [tag, sha, dateString] = tagData.split('|')
|
||||
if (!mm.isMatch(tag, tagsPattern) || mm.isMatch(tag, ignorePatterns)) {
|
||||
continue
|
||||
}
|
||||
const date = new Date(dateString)
|
||||
if (currentShaDate && date >= currentShaDate) {
|
||||
continue
|
||||
}
|
||||
// Found a suitable tag, no need to continue
|
||||
previousTag.tag = tag
|
||||
previousTag.sha = sha
|
||||
break
|
||||
}
|
||||
|
||||
if (!previousTag.tag) {
|
||||
core.warning('No previous tag found')
|
||||
}
|
||||
|
||||
return previousTag
|
||||
}
|
||||
|
||||
export const canDiffCommits = async ({
|
||||
|
@ -807,7 +945,7 @@ export const canDiffCommits = async ({
|
|||
} else {
|
||||
const {exitCode, stderr} = await exec.getExecOutput(
|
||||
'git',
|
||||
['diff', '--quiet', sha1, sha2],
|
||||
['diff', '--no-patch', sha1, sha2],
|
||||
{
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
|
@ -874,7 +1012,7 @@ export const jsonOutput = ({
|
|||
value,
|
||||
shouldEscape
|
||||
}: {
|
||||
value: string | string[]
|
||||
value: string | string[] | boolean
|
||||
shouldEscape: boolean
|
||||
}): string => {
|
||||
const result = JSON.stringify(value)
|
||||
|
@ -899,93 +1037,101 @@ export const getFilePatterns = async ({
|
|||
inputs: Inputs
|
||||
workingDirectory: string
|
||||
}): Promise<string[]> => {
|
||||
let filePatterns = inputs.files
|
||||
.split(inputs.filesSeparator)
|
||||
.filter(Boolean)
|
||||
.join('\n')
|
||||
let cleanedFilePatterns: string[] = []
|
||||
|
||||
if (inputs.files) {
|
||||
const filesPatterns = inputs.files
|
||||
.split(inputs.filesSeparator)
|
||||
.map(p => (p.endsWith(path.sep) ? `${p}**` : p))
|
||||
.filter(Boolean)
|
||||
|
||||
cleanedFilePatterns.push(...filesPatterns)
|
||||
|
||||
core.debug(`files patterns: ${filesPatterns.join('\n')}`)
|
||||
}
|
||||
|
||||
if (inputs.filesFromSourceFile !== '') {
|
||||
const inputFilesFromSourceFile = inputs.filesFromSourceFile
|
||||
.split(inputs.filesFromSourceFileSeparator)
|
||||
.filter(p => p !== '')
|
||||
.filter(Boolean)
|
||||
.map(p => path.join(workingDirectory, p))
|
||||
|
||||
core.debug(`files from source file: ${inputFilesFromSourceFile}`)
|
||||
|
||||
const filesFromSourceFiles = (
|
||||
await getFilesFromSourceFile({filePaths: inputFilesFromSourceFile})
|
||||
).join('\n')
|
||||
const filesFromSourceFiles = await getFilesFromSourceFile({
|
||||
filePaths: inputFilesFromSourceFile
|
||||
})
|
||||
|
||||
core.debug(`files from source files patterns: ${filesFromSourceFiles}`)
|
||||
core.debug(
|
||||
`files from source files patterns: ${filesFromSourceFiles.join('\n')}`
|
||||
)
|
||||
|
||||
filePatterns = filePatterns.concat('\n', filesFromSourceFiles)
|
||||
cleanedFilePatterns.push(...filesFromSourceFiles)
|
||||
}
|
||||
|
||||
if (inputs.filesIgnore) {
|
||||
const filesIgnorePatterns = inputs.filesIgnore
|
||||
.split(inputs.filesIgnoreSeparator)
|
||||
.filter(p => p !== '')
|
||||
.filter(Boolean)
|
||||
.map(p => {
|
||||
if (!p.startsWith('!')) {
|
||||
p = `!${p}`
|
||||
p = p.startsWith('!') ? p : `!${p}`
|
||||
if (p.endsWith(path.sep)) {
|
||||
p = `${p}**`
|
||||
}
|
||||
return p
|
||||
})
|
||||
.join('\n')
|
||||
|
||||
core.debug(`files ignore patterns: ${filesIgnorePatterns}`)
|
||||
core.debug(`files ignore patterns: ${filesIgnorePatterns.join('\n')}`)
|
||||
|
||||
filePatterns = filePatterns.concat('\n', filesIgnorePatterns)
|
||||
cleanedFilePatterns.push(...filesIgnorePatterns)
|
||||
}
|
||||
|
||||
if (inputs.filesIgnoreFromSourceFile) {
|
||||
const inputFilesIgnoreFromSourceFile = inputs.filesIgnoreFromSourceFile
|
||||
.split(inputs.filesIgnoreFromSourceFileSeparator)
|
||||
.filter(p => p !== '')
|
||||
.filter(Boolean)
|
||||
.map(p => path.join(workingDirectory, p))
|
||||
|
||||
core.debug(
|
||||
`files ignore from source file: ${inputFilesIgnoreFromSourceFile}`
|
||||
)
|
||||
|
||||
const filesIgnoreFromSourceFiles = (
|
||||
await getFilesFromSourceFile({
|
||||
filePaths: inputFilesIgnoreFromSourceFile,
|
||||
excludedFiles: true
|
||||
})
|
||||
).join('\n')
|
||||
const filesIgnoreFromSourceFiles = await getFilesFromSourceFile({
|
||||
filePaths: inputFilesIgnoreFromSourceFile,
|
||||
excludedFiles: true
|
||||
})
|
||||
|
||||
core.debug(
|
||||
`files ignore from source files patterns: ${filesIgnoreFromSourceFiles}`
|
||||
`files ignore from source files patterns: ${filesIgnoreFromSourceFiles.join(
|
||||
'\n'
|
||||
)}`
|
||||
)
|
||||
|
||||
filePatterns = filePatterns.concat('\n', filesIgnoreFromSourceFiles)
|
||||
cleanedFilePatterns.push(...filesIgnoreFromSourceFiles)
|
||||
}
|
||||
|
||||
if (inputs.negationPatternsFirst) {
|
||||
cleanedFilePatterns.sort((a, b) => {
|
||||
return a.startsWith('!') ? -1 : b.startsWith('!') ? 1 : 0
|
||||
})
|
||||
}
|
||||
|
||||
// Reorder file patterns '**' should come first
|
||||
if (cleanedFilePatterns.includes('**')) {
|
||||
cleanedFilePatterns.sort((a, b) => {
|
||||
return a === '**' ? -1 : b === '**' ? 1 : 0
|
||||
})
|
||||
}
|
||||
|
||||
if (isWindows()) {
|
||||
filePatterns = filePatterns.replace(/\r\n/g, '\n')
|
||||
filePatterns = filePatterns.replace(/\r/g, '\n')
|
||||
cleanedFilePatterns = cleanedFilePatterns.map(pattern =>
|
||||
pattern.replace(/\r\n/g, '\n').replace(/\r/g, '\n')
|
||||
)
|
||||
}
|
||||
|
||||
core.debug(`Input file patterns: ${filePatterns}`)
|
||||
core.debug(`Input file patterns: \n${cleanedFilePatterns.join('\n')}`)
|
||||
|
||||
return filePatterns
|
||||
.trim()
|
||||
.split('\n')
|
||||
.filter(Boolean)
|
||||
.map(pattern => {
|
||||
if (pattern.endsWith('/')) {
|
||||
return `${pattern}**`
|
||||
} else {
|
||||
const pathParts = pattern.split('/')
|
||||
const lastPart = pathParts[pathParts.length - 1]
|
||||
if (!lastPart.includes('.') && !lastPart.includes('*')) {
|
||||
return `${pattern}/**`
|
||||
} else {
|
||||
return pattern
|
||||
}
|
||||
}
|
||||
})
|
||||
return cleanedFilePatterns
|
||||
}
|
||||
|
||||
// Example YAML input:
|
||||
|
@ -1031,7 +1177,7 @@ const getYamlFilePatternsFromContents = async ({
|
|||
throw new Error(`File does not exist: ${filePath}`)
|
||||
}
|
||||
|
||||
source = await readFile(filePath, 'utf8')
|
||||
source = await fs.readFile(filePath, 'utf8')
|
||||
} else {
|
||||
source = content
|
||||
}
|
||||
|
@ -1112,16 +1258,11 @@ export const getYamlFilePatterns = async ({
|
|||
const newFilePatterns = await getYamlFilePatternsFromContents({filePath})
|
||||
for (const key in newFilePatterns) {
|
||||
if (key in filePatterns) {
|
||||
core.warning(
|
||||
`files_yaml_from_source_file: Duplicated key ${key} detected in ${filePath}, the ${filePatterns[key]} will be overwritten by ${newFilePatterns[key]}.`
|
||||
)
|
||||
filePatterns[key] = [...filePatterns[key], ...newFilePatterns[key]]
|
||||
} else {
|
||||
filePatterns[key] = newFilePatterns[key]
|
||||
}
|
||||
}
|
||||
|
||||
filePatterns = {
|
||||
...filePatterns,
|
||||
...newFilePatterns
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1133,9 +1274,12 @@ export const getYamlFilePatterns = async ({
|
|||
|
||||
for (const key in newIgnoreFilePatterns) {
|
||||
if (key in filePatterns) {
|
||||
core.warning(
|
||||
`files_ignore_yaml: Duplicated key ${key} detected, the ${filePatterns[key]} will be overwritten by ${newIgnoreFilePatterns[key]}.`
|
||||
)
|
||||
filePatterns[key] = [
|
||||
...filePatterns[key],
|
||||
...newIgnoreFilePatterns[key]
|
||||
]
|
||||
} else {
|
||||
filePatterns[key] = newIgnoreFilePatterns[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1159,16 +1303,14 @@ export const getYamlFilePatterns = async ({
|
|||
|
||||
for (const key in newIgnoreFilePatterns) {
|
||||
if (key in filePatterns) {
|
||||
core.warning(
|
||||
`files_ignore_yaml_from_source_file: Duplicated key ${key} detected in ${filePath}, the ${filePatterns[key]} will be overwritten by ${newIgnoreFilePatterns[key]}.`
|
||||
)
|
||||
filePatterns[key] = [
|
||||
...filePatterns[key],
|
||||
...newIgnoreFilePatterns[key]
|
||||
]
|
||||
} else {
|
||||
filePatterns[key] = newIgnoreFilePatterns[key]
|
||||
}
|
||||
}
|
||||
|
||||
filePatterns = {
|
||||
...filePatterns,
|
||||
...newIgnoreFilePatterns
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1205,21 +1347,66 @@ export const getRecoverFilePatterns = ({
|
|||
return filePatterns.filter(Boolean)
|
||||
}
|
||||
|
||||
export const getOutputKey = (key: string, outputPrefix: string): string => {
|
||||
return outputPrefix ? `${outputPrefix}_${key}` : key
|
||||
}
|
||||
|
||||
export const setArrayOutput = async ({
|
||||
key,
|
||||
inputs,
|
||||
value,
|
||||
outputPrefix
|
||||
}: {
|
||||
key: string
|
||||
inputs: Inputs
|
||||
value: string[]
|
||||
outputPrefix?: string
|
||||
}): Promise<void> => {
|
||||
core.debug(`${key}: ${JSON.stringify(value)}`)
|
||||
await setOutput({
|
||||
key: outputPrefix ? getOutputKey(key, outputPrefix) : key,
|
||||
value: inputs.json ? value : value.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson,
|
||||
safeOutput: inputs.safeOutput
|
||||
})
|
||||
}
|
||||
|
||||
export const setOutput = async ({
|
||||
key,
|
||||
value,
|
||||
inputs
|
||||
writeOutputFiles,
|
||||
outputDir,
|
||||
json = false,
|
||||
shouldEscape = false,
|
||||
safeOutput = false
|
||||
}: {
|
||||
key: string
|
||||
value: string | boolean
|
||||
inputs: Inputs
|
||||
value: string | string[] | boolean
|
||||
writeOutputFiles: boolean
|
||||
outputDir: string
|
||||
json?: boolean
|
||||
shouldEscape?: boolean
|
||||
safeOutput?: boolean
|
||||
}): Promise<void> => {
|
||||
const cleanedValue = value.toString().trim()
|
||||
let cleanedValue
|
||||
if (json) {
|
||||
cleanedValue = jsonOutput({value, shouldEscape})
|
||||
} else {
|
||||
cleanedValue = value.toString().trim()
|
||||
}
|
||||
|
||||
// if safeOutput is true, escape special characters for bash shell
|
||||
if (safeOutput) {
|
||||
cleanedValue = cleanedValue.replace(/[^\x20-\x7E]|[:*?<>|;`$()&!]/g, '\\$&')
|
||||
}
|
||||
|
||||
core.setOutput(key, cleanedValue)
|
||||
|
||||
if (inputs.writeOutputFiles) {
|
||||
const outputDir = inputs.outputDir
|
||||
const extension = inputs.json ? 'json' : 'txt'
|
||||
if (writeOutputFiles) {
|
||||
const extension = json ? 'json' : 'txt'
|
||||
const outputFilePath = path.join(outputDir, `${key}.${extension}`)
|
||||
|
||||
if (!(await exists(outputDir))) {
|
||||
|
@ -1262,13 +1449,17 @@ export const recoverDeletedFiles = async ({
|
|||
workingDirectory,
|
||||
deletedFiles,
|
||||
recoverPatterns,
|
||||
sha
|
||||
diffResult,
|
||||
diffSubmodule,
|
||||
submodulePaths
|
||||
}: {
|
||||
inputs: Inputs
|
||||
workingDirectory: string
|
||||
deletedFiles: string[]
|
||||
recoverPatterns: string[]
|
||||
sha: string
|
||||
diffResult: DiffResult
|
||||
diffSubmodule: boolean
|
||||
submodulePaths: string[]
|
||||
}): Promise<void> => {
|
||||
let recoverableDeletedFiles = deletedFiles
|
||||
core.debug(`recoverable deleted files: ${recoverableDeletedFiles}`)
|
||||
|
@ -1293,19 +1484,64 @@ export const recoverDeletedFiles = async ({
|
|||
)
|
||||
}
|
||||
|
||||
const deletedFileContents = await getDeletedFileContents({
|
||||
cwd: workingDirectory,
|
||||
filePath: deletedFile,
|
||||
sha
|
||||
})
|
||||
let deletedFileContents: string
|
||||
|
||||
const submodulePath = submodulePaths.find(p => deletedFile.startsWith(p))
|
||||
|
||||
if (diffSubmodule && submodulePath) {
|
||||
const submoduleShaResult = await gitSubmoduleDiffSHA({
|
||||
cwd: workingDirectory,
|
||||
parentSha1: diffResult.previousSha,
|
||||
parentSha2: diffResult.currentSha,
|
||||
submodulePath,
|
||||
diff: diffResult.diff
|
||||
})
|
||||
|
||||
if (submoduleShaResult.previousSha) {
|
||||
core.debug(
|
||||
`recovering deleted file "${deletedFile}" from submodule ${submodulePath} from ${submoduleShaResult.previousSha}`
|
||||
)
|
||||
deletedFileContents = await getDeletedFileContents({
|
||||
cwd: path.join(workingDirectory, submodulePath),
|
||||
// E.g. submodulePath = test/demo and deletedFile = test/demo/.github/README.md => filePath => .github/README.md
|
||||
filePath: deletedFile.replace(submodulePath, '').substring(1),
|
||||
sha: submoduleShaResult.previousSha
|
||||
})
|
||||
} else {
|
||||
core.warning(
|
||||
`Unable to recover deleted file "${deletedFile}" from submodule ${submodulePath} from ${submoduleShaResult.previousSha}`
|
||||
)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
core.debug(
|
||||
`recovering deleted file "${deletedFile}" from ${diffResult.previousSha}`
|
||||
)
|
||||
deletedFileContents = await getDeletedFileContents({
|
||||
cwd: workingDirectory,
|
||||
filePath: deletedFile,
|
||||
sha: diffResult.previousSha
|
||||
})
|
||||
}
|
||||
|
||||
core.debug(`recovered deleted file "${deletedFile}"`)
|
||||
|
||||
if (!(await exists(path.dirname(target)))) {
|
||||
core.debug(`creating directory "${path.dirname(target)}"`)
|
||||
await fs.mkdir(path.dirname(target), {recursive: true})
|
||||
}
|
||||
core.debug(`writing file "${target}"`)
|
||||
await fs.writeFile(target, deletedFileContents)
|
||||
core.debug(`wrote file "${target}"`)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the specified working directory has a local Git directory.
|
||||
*
|
||||
* @param workingDirectory - The path of the working directory.
|
||||
* @returns A boolean value indicating whether the working directory has a local Git directory.
|
||||
*/
|
||||
export const hasLocalGitDirectory = async ({
|
||||
workingDirectory
|
||||
}: {
|
||||
|
@ -1315,3 +1551,33 @@ export const hasLocalGitDirectory = async ({
|
|||
cwd: workingDirectory
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Warns about unsupported inputs when using the REST API.
|
||||
*
|
||||
* @param inputs - The inputs object.
|
||||
*/
|
||||
export const warnUnsupportedRESTAPIInputs = async ({
|
||||
inputs
|
||||
}: {
|
||||
inputs: Inputs
|
||||
}): Promise<void> => {
|
||||
for (const key of Object.keys(DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS)) {
|
||||
const defaultValue = Object.hasOwnProperty.call(
|
||||
DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS,
|
||||
key
|
||||
)
|
||||
? DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[
|
||||
key as keyof Inputs
|
||||
]?.toString()
|
||||
: ''
|
||||
|
||||
if (defaultValue !== inputs[key as keyof Inputs]?.toString()) {
|
||||
core.warning(
|
||||
`Input "${snakeCase(
|
||||
key
|
||||
)}" is not supported when using GitHub's REST API to get changed files`
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8bbc72611c1e47c6aeb1f68247ca84f277473498
|
||||
Subproject commit c6bd3b33a9020f54e389066cc88e510015fefd13
|
1
test/new.md
Normal file
1
test/new.md
Normal file
|
@ -0,0 +1 @@
|
|||
This is a test markdown file
|
|
@ -1 +1 @@
|
|||
This is a test file.
|
||||
This is a test file...
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"target": "ES2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
|
|
Loading…
Add table
Reference in a new issue