Skip to content

improve CLI #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ To run the script in GitHub Codespaces:
note: if you're using GitHub Codespaces, this step may have already been run automatically
6. run the script with
```
node unfollow.js
SCRIPT_USERNAME=your_username SCRIPT_TOKEN=your_token SCRIPT_LIMIT=2500 node unfollow.js
```
(Change SCRIPT_LIMIT to your desired subset size. If not set, defaults to 1000.)

**Note:**
- The above one-line command works in Codespaces, as I tested it myself.
- On local Windows (Command Prompt or PowerShell), this command might not work as shown.
If you are on Windows and encounter issues, it is highly
encouraged to use GitHub Codespaces for a seamless experience.

## USE CASE

Expand Down
18 changes: 15 additions & 3 deletions unfollow.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
(async () => {
const { Octokit } = await import("@octokit/rest");
const octokit = new Octokit({ auth: `your_token_with_correct_permission` });
// Read credentials from environment variables
const username = process.env.SCRIPT_USERNAME;
const token = process.env.SCRIPT_TOKEN;
// Allow limit to be set via environment variable or default to 1000
const limit = process.env.SCRIPT_LIMIT ? parseInt(process.env.SCRIPT_LIMIT, 10) : 1000;

if (!username || !token) {
console.error("Error: SCRIPT_USERNAME and SCRIPT_TOKEN must be set as environment variables.");
process.exit(1);
}
if (isNaN(limit) || limit <= 0) {
console.error("Error: SCRIPT_LIMIT must be a positive integer if set.");
process.exit(1);
}

const username = 'your_username';
const limit = 1000;
const octokit = new Octokit({ auth: token });

const userInfo = await octokit.rest.users.getByUsername({ username });
const totalFollowing = userInfo.data.following;
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy