An open API service indexing awesome lists of open source software.

https://github.com/shineii86/galaxybrain

🧠 Automate GitHub Galaxy Brain achievement β€” creates accepted answers in Discussions via GraphQL API. Colab-ready.
https://github.com/shineii86/galaxybrain

achievements automation colab-notebook github python

Last synced: 6 days ago
JSON representation

🧠 Automate GitHub Galaxy Brain achievement β€” creates accepted answers in Discussions via GraphQL API. Colab-ready.

Awesome Lists containing this project

README

          

[![Galaxy Brain Banner](https://raw.githubusercontent.com/Shineii86/GalaxyBrain/main/images/GalaxyBrain.png)](https://github.com/Shineii86/GalaxyBrain)

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Shineii86/GalaxyBrain/blob/main/notebooks/GalaxyBrain.ipynb)
[![Python 3.8+](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

[![GitHub Stars](https://img.shields.io/github/stars/Shineii86/GalaxyBrain?style=for-the-badge)](https://github.com/Shineii86/GalaxyBrain/stargazers)
[![GitHub Forks](https://img.shields.io/github/forks/Shineii86/GalaxyBrain?style=for-the-badge)](https://github.com/Shineii86/GalaxyBrain/fork)

A **fully automated** Python script that runs in **Google Colab** to earn the **Galaxy Brain** achievement by creating accepted answers in GitHub Discussions.

---

> [!WARNING]
> **This script automates interactions with GitHub Discussions to artificially trigger the Galaxy Brain achievement.**
> - **Use responsibly.** Inflating achievements may be viewed negatively by potential employers or collaborators, and may violate GitHub's Terms of Service.
> - You need **Personal Access Tokens (classic)** with `repo` and `write:discussion` scopes for **each account** involved (main + at least two secondaries).
> - The script creates discussions and answers in your repository. **Ensure Discussions are enabled** and a **Q&A category exists**.
> - This tool is intended for **educational purposes and personal experimentation** only.

---

## πŸ“– Table of Contents

- [What is This Tool?](#-what-is-this-tool)
- [Why Use This Method?](#-why-use-this-method)
- [Prerequisites](#-prerequisites)
- [1. Required Accounts](#1-required-accounts)
- [2. Enable Discussions on Your Repository](#2-enable-discussions-on-your-repository)
- [3. Create a Q&A Category](#3-create-a-qa-category)
- [4. Generate Personal Access Tokens (Classic)](#4-generate-personal-access-tokens-classic)
- [5. Add Secondary Accounts as Collaborators](#5-add-secondary-accounts-as-collaborators)
- [Step-by-Step Guide](#-step-by-step-guide)
- [Configuration Options](#-configuration-options)
- [How It Works](#-how-it-works-technical-overview)
- [Troubleshooting](#-troubleshooting)
- [License & Disclaimer](#-license--disclaimer)

---

## 🎯 What is This Tool?

This tool automates the process of earning the **Galaxy Brain** achievement on GitHub. Galaxy Brain is awarded when a user has **at least two answers marked as accepted** in GitHub Discussions.

Using the **GitHub GraphQL API**, the script:
1. Creates a discussion from a **secondary account**.
2. Posts an answer to that discussion from the **main account** (this is who earns the achievement).
3. Marks that answer as **accepted** using the secondary account.

This process is repeated until the desired number of accepted answers is reached (minimum **2** for the achievement).

> [!NOTE]
> This tool does **not** guarantee immediate achievement unlock. GitHub may take up to 24 hours to update achievement status.

---

## βœ… Why Use This Method?

| Feature | Benefit |
|------------------------------|-------------------------------------------------------------------------|
| ☁️ **No PC Required** | Runs entirely in Google Colab (cloud‑based). Works on any device with a browser. |
| πŸ” **Multi‑Account Support** | Handles up to two secondary accounts (easily extendable). |
| πŸ“ˆ **Configurable Answers** | Set the exact number of accepted answers you need. |
| πŸ›‘οΈ **GraphQL API** | Uses official GitHub APIsβ€”no browser automation or scraping. |
| πŸ“¦ **Minimal Dependencies** | Only requires `requests` and standard libraries. |

---

## 🧰 Prerequisites

### 1. Required Accounts

- **One main GitHub account** – This account will receive the Galaxy Brain achievement.
- **At least two secondary GitHub accounts** – These accounts will post the answers that the main account accepts. You can use existing accounts or create new ones.

### 2. Enable Discussions on Your Repository

1. Go to the repository under your main account.
2. Click **Settings** β†’ **Features**.
3. Under **Discussions**, check **Enable Discussions**.

### 3. Create a Q&A Category

The script requires a discussion category that supports **accepted answers** (Q&A format). If you don't have one, create it:

1. In your repository, go to **Settings** β†’ **Discussions** β†’ **Categories**.
2. Click **New category**.
3. Choose **Q&A** format and give it a name (e.g., "Q&A").
4. Click **Create**.

> The script automatically selects the first answerable category it finds.

### 4. Generate Personal Access Tokens (Classic)

You need a **Personal Access Token (Classic)** for **each account** (main and both secondaries). These tokens grant the script permission to act on behalf of each account.

> [!IMPORTANT]
> **Required scopes for all tokens (main and secondary):**
> - `repo` – Grants full control of private repositories (required for posting answers).
> - `write:discussion` – Grants read/write access to GitHub Discussions.

#### How to Create a Token

For **each account** (main, secondary1, secondary2), repeat these steps:

1. Log in to the account and go to **Settings** β†’ **Developer settings** β†’ **Personal access tokens** β†’ **Tokens (classic)**.
2. Click **Generate new token** β†’ **Generate new token (classic)**.
3. Give it a descriptive **Note** (e.g., `Galaxy Brain Script`).
4. Set an **Expiration** (e.g., 7 days – recommended for security).
5. Under **Select scopes**, check the following boxes:
- β˜‘οΈ **repo** (this automatically selects all sub‑scopes under `repo`)
- β˜‘οΈ **write:discussion** (under `write:discussion`)
6. Click **Generate token**.
7. **Copy the token immediately** (it starts with `ghp_`) and store it securely. You will not be able to see it again.

> πŸ”’ **Security Note:** Treat these tokens like passwords. Never commit them to a public repository or share them with anyone.

### 5. Add Secondary Accounts as Collaborators

The secondary accounts must have **write access** to your repository to post answers. You need to invite them as collaborators.

1. Go to your repository (under the main account) β†’ **Settings** β†’ **Collaborators and teams**.
2. Click **Add people** and enter the username of the first secondary account.
3. Click **Add to repository**.
4. Repeat for the second secondary account.

**Accept the Invitation:**
- Log in to each secondary account, go to `https://github.com/YOUR_MAIN_USERNAME/REPO_NAME` or check the email notification, and **accept the invitation**.

> βœ… **Verification:** You can confirm a secondary account has access by logging into that account and checking if you can see the repository in your list of repositories.

---

## πŸ“₯ How to Deploy

### 1️⃣ One‑Click Colab


Open In Colab

### 2️⃣ Fill in the Configuration Form

Inside the Colab notebook, you'll find a single configuration cell with form fields:

| Variable | Description | Example Value |
|-------------------|---------------------------------------------------------------------------|-----------------------------|
| `MAIN_USERNAME` | Your main GitHub handle (to earn the achievement) | `"Shineii86"` |
| `MAIN_TOKEN` | Personal Access Token for main account | `"ghp_abc123..."` |
| `USERNAME_1` | First secondary account handle | `"helper1"` |
| `TOKEN_1` | Personal Access Token for first secondary account | `"ghp_def456..."` |
| `USERNAME_2` | Second secondary account handle | `"helper2"` |
| `TOKEN_2` | Personal Access Token for second secondary account | `"ghp_ghi789..."` |
| `REPO_NAME` | Target repository (must exist under `MAIN_USERNAME`) | `"galaxy-brain-demo"` |
| `NUM_ANSWERS` | Number of accepted answers to create (minimum 2 for Galaxy Brain) | `2` |
| `ACTION_DELAY` | Seconds to wait between API calls (increase to appear more natural) | `5` |

### 3️⃣ Run the Notebook

Click **Runtime β†’ Run all** (or press `Ctrl+F9`). The notebook will:
- Install `requests`
- Fetch your repository ID and an answerable category
- For each requested answer:
- Create a discussion (main account)
- Post an answer (secondary account)
- Mark the answer as accepted (main account)
- Display progress and final status

You'll see real‑time output like:

```
🧠 Galaxy Brain Automation for user 'Shineii86'
Repository: Shineii86/galaxy-brain-demo
Creating 2 accepted answer(s)

πŸ” Fetching repository information...
βœ… Found repository ID and answerable category: 'Q&A'

--- Processing answer 1 of 2 ---
πŸ‘€ Secondary account: helper1
πŸ“ Creating discussion...
πŸ“ Discussion created: https://github.com/Shineii86/galaxy-brain-demo/discussions/1
πŸ’¬ Posting answer as helper1...
πŸ’¬ Answer posted by secondary account
βœ… Marking answer as accepted...
βœ… Answer marked as accepted
πŸŽ‰ Answer 1 accepted!

--- Processing answer 2 of 2 ---
...

==================================================
✨ Success! Created 2 accepted answer(s).
πŸ“Š Check your profile: https://github.com/Shineii86
πŸ”” Note: Achievements may take up to 24 hours to appear.
```

### 4️⃣ Check Your Achievements

1. Go to your GitHub profile: `https://github.com/YOUR_USERNAME`
2. Scroll down to the **Achievements** section (if you already have some) or visit `https://github.com/settings/achievements`.
3. **Galaxy Brain** should appear within 24 hours.

---

## βš™οΈ Configuration Options

| Parameter | Default | Description |
|------------------|---------|---------------------------------------------------------------------------------------------------------------|
| `MAIN_USERNAME` | β€” | The GitHub username that will earn the achievement. |
| `MAIN_TOKEN` | β€” | PAT for the main account with `repo` and `write:discussion` scopes. |
| `USERNAME_1` | β€” | Username for the first secondary (answerer) account. |
| `TOKEN_1` | β€” | PAT for the first secondary account with identical scopes. |
| `USERNAME_2` | β€” | Username for the second secondary account. |
| `TOKEN_2` | β€” | PAT for the second secondary account. |
| `REPO_NAME` | β€” | Repository name (under `MAIN_USERNAME`) where discussions will be created. |
| `NUM_ANSWERS` | `2` | Number of accepted answers to create. Set to `2` for Galaxy Brain, or higher for testing. |
| `ACTION_DELAY` | `5` | Delay in seconds between API calls. Increase to `10–15` to mimic human behavior and reduce detection risk. |

### Adding More Secondary Accounts

If you need more than two answers from distinct accounts, you can extend the `secondary_accounts` list inside the script:

```python
secondary_accounts = [
{"username": USERNAME_1, "token": TOKEN_1},
{"username": USERNAME_2, "token": TOKEN_2},
{"username": "helper3", "token": "ghp_..."}, # Add more
]
```

---

## πŸ”¬ How It Works (Technical Overview)

The script interacts with the **GitHub GraphQL API v4** using the following mutations:

1. **`createDiscussion`** – Creates a new discussion in the specified repository category.
2. **`addDiscussionComment`** – Posts a comment (answer) to a discussion.
3. **`markDiscussionCommentAsAnswer`** – Marks a comment as the accepted answer.

**Workflow:**

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Secondary Account │────▢│ Create Discussion │────▢│ Discussion Created β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Main Account │────▢│ Post Answer │◀────│ Discussion ID β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Answer Comment ID β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Secondary Account │────▢│ Mark as Accepted β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

> **Note:** The achievement is awarded to whoever **posts** the accepted answer.
> The main account posts answers (and earns Galaxy Brain), while secondaries create discussions and accept them.

All requests are authenticated via `Authorization: Bearer ` headers. Delays between actions help avoid rate limiting and make the activity appear more organic.

---

## πŸ†˜ Troubleshooting

| Issue | Solution |
|----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Repository not found or no access` | Verify the repository name and that your main token has `repo` scope. Ensure the repository exists. |
| `Repository has no discussion categories` | Enable Discussions in repository settings (Settings β†’ Features β†’ Discussions). |
| `GraphQL errors: ... 'does not belong to a discussion in a category that supports answers'` | The discussion category (e.g., "Announcements") does not allow accepted answers. Create a **Q&A** category:
1. Go to `Settings` β†’ `Discussions` β†’ `Categories`.
2. Click **New category**.
3. Choose **Q&A** format and name it (e.g., "Q&A").
4. Save and re-run the script. |
| `GraphQL errors: ...` or `Bad credentials` | Your token is incorrect, expired, or lacks the required scopes (`repo`, `write:discussion`). |
| Secondary account cannot post answer | Ensure the secondary account has accepted the collaborator invitation to the repository. |
| Achievement not appearing after 24 hours | Wait longer (up to 48 hours). Ensure you have **at least two** accepted answers. Check that the answers are still marked as accepted (not unmarked). |
| `Rate limit exceeded` | Increase `ACTION_DELAY` or wait before running again. GitHub's GraphQL rate limit is generous (5,000 points/hour). |

---

## πŸ“„ License & Disclaimer

This project is licensed under the **MIT License** – see the [LICENSE](LICENSE) file for details.

> [!WARNING]
> This script is intended for **educational purposes and personal experimentation** only. Artificially triggering achievements may be viewed negatively by potential employers or collaborators, and may violate GitHub's Terms of Service. The author is not responsible for any consequences arising from misuse of this tool, including but not limited to account suspension, damage to professional reputation, or violation of platform terms.

---

### πŸ”— Quick Links

- [Google Colab](https://colab.research.google.com/)
- [GitHub Personal Access Tokens](https://github.com/settings/tokens)
- [GitHub GraphQL API Documentation](https://docs.github.com/en/graphql)
- [GitHub Achievements](https://github.com/settings/achievements)

---

## πŸ’• Loved My Work?

🚨 [Follow me on GitHub](https://github.com/Shineii86)

⭐ [Give a star to this project](https://github.com/Shineii86/GalaxyBrain)


Banner


*For inquiries or collaborations*

[![Telegram Badge](https://img.shields.io/badge/-Telegram-2CA5E0?style=flat&logo=Telegram&logoColor=white)](https://telegram.me/Shineii86 "Contact on Telegram")
[![Instagram Badge](https://img.shields.io/badge/-Instagram-C13584?style=flat&logo=Instagram&logoColor=white)](https://instagram.com/ikx7.a "Follow on Instagram")
[![Pinterest Badge](https://img.shields.io/badge/-Pinterest-E60023?style=flat&logo=Pinterest&logoColor=white)](https://pinterest.com/ikx7a "Follow on Pinterest")
[![Gmail Badge](https://img.shields.io/badge/-Gmail-D14836?style=flat&logo=Gmail&logoColor=white)](mailto:ikx7a@hotmail.com "Send an Email")

Copyright Β© 2026 Shinei Nouzen All Rights Reserved

![Last Commit](https://img.shields.io/github/last-commit/Shineii86/GalaxyBrain?style=for-the-badge)