From 4eb350a62a1ab47f24eb80bfda4773a171e0145e Mon Sep 17 00:00:00 2001 From: jfullstackdev Date: Sat, 5 Jul 2025 08:40:04 +0000 Subject: [PATCH 1/3] implement Params so that needed data is in the Prompt not in the Code --- README.md | 7 ++++++- unfollow.js | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fccd709..10a0d64 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,13 @@ 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 + GITHUB_USERNAME=your_username GITHUB_TOKEN=your_token LIMIT=2500 node unfollow.js ``` + (Change 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 diff --git a/unfollow.js b/unfollow.js index 351c1e6..ce60465 100644 --- a/unfollow.js +++ b/unfollow.js @@ -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.GITHUB_USERNAME; + const token = process.env.GITHUB_TOKEN; + // Allow limit to be set via environment variable or default to 1000 + const limit = process.env.LIMIT ? parseInt(process.env.LIMIT, 10) : 1000; + + if (!username || !token) { + console.error("Error: GITHUB_USERNAME and GITHUB_TOKEN must be set as environment variables."); + process.exit(1); + } + if (isNaN(limit) || limit <= 0) { + console.error("Error: 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; From b2a6c2fe864153b6aeab558a4a43d92a9a1693f2 Mon Sep 17 00:00:00 2001 From: jfullstackdev Date: Sat, 5 Jul 2025 09:35:27 +0000 Subject: [PATCH 2/3] update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 10a0d64..fce41b1 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ To run the script in GitHub Codespaces: **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. +- 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 From 7027f6c82deca78e3900a3347afa6ff411758894 Mon Sep 17 00:00:00 2001 From: jfullstackdev Date: Sat, 5 Jul 2025 10:39:41 +0000 Subject: [PATCH 3/3] update Param names to avoid default Param names --- README.md | 4 ++-- unfollow.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fce41b1..f1c0c20 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ 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 ``` - GITHUB_USERNAME=your_username GITHUB_TOKEN=your_token LIMIT=2500 node unfollow.js + SCRIPT_USERNAME=your_username SCRIPT_TOKEN=your_token SCRIPT_LIMIT=2500 node unfollow.js ``` - (Change LIMIT to your desired subset size. If not set, defaults to 1000.) + (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. diff --git a/unfollow.js b/unfollow.js index ce60465..0ef2989 100644 --- a/unfollow.js +++ b/unfollow.js @@ -1,17 +1,17 @@ (async () => { const { Octokit } = await import("@octokit/rest"); // Read credentials from environment variables - const username = process.env.GITHUB_USERNAME; - const token = process.env.GITHUB_TOKEN; + 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.LIMIT ? parseInt(process.env.LIMIT, 10) : 1000; + const limit = process.env.SCRIPT_LIMIT ? parseInt(process.env.SCRIPT_LIMIT, 10) : 1000; if (!username || !token) { - console.error("Error: GITHUB_USERNAME and GITHUB_TOKEN must be set as environment variables."); + 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: LIMIT must be a positive integer if set."); + console.error("Error: SCRIPT_LIMIT must be a positive integer if set."); process.exit(1); } 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