Skip to content

Commit 7ed5e42

Browse files
authored
Update main.js
1 parent 4b25262 commit 7ed5e42

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ async function run() {
66
const token = core.getInput('token');
77
const repository = core.getInput('repository');
88
const isReadmeUpdate = core.getInput('isReadmeUpdate') === 'true';
9+
const isEnableFollow = core.getInput('isEnableFollow') === 'true';
10+
const isEnableUnfollow = core.getInput('isEnableUnfollow') === 'true';
911
const safeUserList = core.getInput('safeUserList').split(",");
1012

1113
const [username, reponame] = repository.split("/");
@@ -17,17 +19,17 @@ async function run() {
1719
const unfollowers = following.filter(user => !followers.some(follower => follower.login === user.login));
1820
const unfollowing = followers.filter(user => !following.some(follow => follow.login === user.login));
1921

20-
if (unfollowers.length > 0) {
22+
if (isEnableUnfollow && unfollowers.length > 0) {
2123
await processUsers(unfollowers, octokit.users.unfollow, safeUserList);
2224
console.log(`You unfollowed ${unfollowers.length} user(s).`);
2325
}
2426

25-
if (unfollowing.length > 0) {
27+
if (isEnableFollow && unfollowing.length > 0) {
2628
await processUsers(unfollowing, octokit.users.follow);
2729
console.log(`You followed ${unfollowing.length} user(s).`);
2830
}
2931

30-
if (isReadmeUpdate && (unfollowers.length > 0 || unfollowing.length > 0)) {
32+
if (isReadmeUpdate && (isEnableFollow || isEnableUnfollow) && (unfollowers.length > 0 || unfollowing.length > 0)) {
3133
await updateReadme(octokit, username, reponame, followers);
3234
}
3335

0 commit comments

Comments
 (0)