Disable GitHub Actions Workflows - Except quantum-x-builder
February 9, 2026 ยท View on GitHub
Overview
This guide explains how to use the disable-workflows-except-qxb.js script to disable GitHub Actions workflows across all your repositories except for quantum-x-builder.
Why Use This Script?
- Batch Operations: Disable Actions for multiple repositories at once
- Safety: Automatically protects
quantum-x-builderfrom being disabled - Flexibility: Supports dry-run, interactive, and automatic modes
- Audit Trail: Clear reporting of what was changed
Prerequisites
1. Node.js
Ensure you have Node.js 16+ installed:
node --version
2. GitHub Personal Access Token
Create a GitHub Personal Access Token with the following permissions:
repo- Full control of private repositoriesworkflow- Update GitHub Action workflows
How to create a token:
- Go to: https://github.com/settings/tokens
- Click "Generate new token" โ "Generate new token (classic)"
- Name:
Disable Workflows Script - Select scopes:
repo,workflow - Click "Generate token"
- Copy the token immediately (you won't see it again!)
3. Set Environment Variable
# Linux/Mac
export GITHUB_TOKEN=ghp_your_token_here
# Windows (PowerShell)
$env:GITHUB_TOKEN="ghp_your_token_here"
# Windows (CMD)
set GITHUB_TOKEN=ghp_your_token_here
Usage
Quick Start
# Navigate to repository
cd /path/to/quantum-x-builder
# Run in dry-run mode (safe preview)
node scripts/disable-workflows-except-qxb.js --dry-run
Modes of Operation
1. Dry Run Mode (Recommended First)
Preview what will be changed without making any modifications:
node scripts/disable-workflows-except-qxb.js --dry-run
Output Example:
โ
Found 25 repositories
๐ Repository Summary:
Total repositories: 25
Protected (excluded): 1
Will be processed: 24
๐ก๏ธ Protected repositories (Actions will remain enabled):
โ InfinityXOneSystems/quantum-x-builder
๐ Checking which repositories have Actions enabled...
โข InfinityXOneSystems/repo1 - Actions ENABLED
โข InfinityXOneSystems/repo2 - Actions ENABLED
โข InfinityXOneSystems/repo3 - Actions already disabled
...
2. Interactive Mode
Confirm each repository individually:
node scripts/disable-workflows-except-qxb.js --interactive
You'll be prompted for each repository:
Disable Actions for InfinityXOneSystems/repo1? (y/N): y
โ
Disabled Actions for: InfinityXOneSystems/repo1
Disable Actions for InfinityXOneSystems/repo2? (y/N): n
โญ๏ธ Skipped: InfinityXOneSystems/repo2
3. Automatic Mode
Disable Actions for all repositories (except quantum-x-builder) without prompts:
node scripts/disable-workflows-except-qxb.js --auto
โ ๏ธ Warning: This will disable Actions on ALL repositories except quantum-x-builder!
Command-Line Options
| Option | Short | Description |
|---|---|---|
--dry-run | -d | Preview changes without applying them (default) |
--interactive | -i | Confirm each repository before disabling |
--auto | -a | Automatically disable all (except quantum-x-builder) |
--owner <name> | -o | Specify GitHub owner/organization |
--token <token> | -t | Provide token directly (alternative to env var) |
--help | -h | Show help message |
Advanced Examples
Specify Organization
node scripts/disable-workflows-except-qxb.js --owner InfinityXOneSystems --auto
Provide Token via Argument
node scripts/disable-workflows-except-qxb.js --token ghp_xxxxx --dry-run
Full Command (All Options)
GITHUB_TOKEN=ghp_xxxxx node scripts/disable-workflows-except-qxb.js \
--owner InfinityXOneSystems \
--auto
What Gets Disabled?
The script calls the GitHub API to:
- Set
enabled: falsefor GitHub Actions on each repository - This prevents:
- Workflow runs from being triggered
- Scheduled workflows from executing
- Manual workflow dispatches
Note: This does NOT delete workflows, it just disables them.
Protected Repositories
The following repositories are automatically protected and will NEVER have Actions disabled:
quantum-x-builder(case-insensitive, matches repository name only regardless of owner)
Note: Protection is based on the repository name (quantum-x-builder), not the full path (e.g., owner/quantum-x-builder). This means quantum-x-builder will be protected regardless of which account or organization owns it.
You can verify protection by checking the script output:
๐ก๏ธ Protected repositories (Actions will remain enabled):
โ InfinityXOneSystems/quantum-x-builder
Safety Features
- Dry Run Default: If no mode is specified, defaults to
--dry-run - Explicit Protection: quantum-x-builder is hardcoded as excluded
- Clear Reporting: Shows which repos are protected vs. processed
- API Error Handling: Gracefully handles API failures
- Rate Limiting: Includes delays to avoid hitting GitHub API limits
Troubleshooting
Error: GITHUB_TOKEN required
Solution: Set the GITHUB_TOKEN environment variable or use --token
export GITHUB_TOKEN=ghp_your_token_here
Error: 401 Unauthorized
Problem: Token is invalid or expired Solution:
- Check token is correct
- Verify token hasn't expired
- Ensure token has
repoandworkflowscopes
Error: 403 Forbidden
Problem: Token doesn't have required permissions
Solution: Recreate token with repo and workflow scopes
Error: 404 Not Found
Problem: Repository doesn't exist or you don't have access Solution: Verify:
- Repository name is correct
- You have access to the repository
- Organization name is correct (if applicable)
Script finds 0 repositories
Problem: Owner/organization not found or no access Solution:
- Check
--ownerparameter is correct - Verify you have access to the organization
- Try without
--ownerto use your personal account
Re-enabling GitHub Actions
If you need to re-enable Actions on a repository:
Via GitHub UI
- Go to repository โ Settings โ Actions โ General
- Under "Actions permissions", select "Allow all actions and reusable workflows"
- Click "Save"
Via GitHub CLI
gh api -X PUT /repos/OWNER/REPO/actions/permissions \
-f enabled=true
Via Script
Create a simple script or modify this one to set enabled: true instead of false.
Verification
After running the script, verify Actions were disabled:
Check Individual Repository
gh api /repos/OWNER/REPO/actions/permissions
Check via UI
- Go to repository
- Click "Actions" tab
- Should see: "Workflows are disabled"
Best Practices
- Always run dry-run first: See what will change before applying
- Use interactive mode for sensitive repos: Review each one individually
- Verify quantum-x-builder protection: Check it's listed in protected repos
- Keep token secure: Never commit tokens to version control
- Use short-lived tokens: Set expiration when creating tokens
- Document your changes: Keep notes on why Actions were disabled
Example Workflows
Safe Exploration
# Step 1: Dry run to see what would happen
GITHUB_TOKEN=ghp_xxx node scripts/disable-workflows-except-qxb.js --dry-run
# Step 2: Review output carefully
# Step 3: Interactive mode to selectively disable
GITHUB_TOKEN=ghp_xxx node scripts/disable-workflows-except-qxb.js --interactive
Bulk Disable (Use with Caution)
# Step 1: Dry run
GITHUB_TOKEN=ghp_xxx node scripts/disable-workflows-except-qxb.js --dry-run
# Step 2: Confirm output looks correct
# Step 3: Execute
GITHUB_TOKEN=ghp_xxx node scripts/disable-workflows-except-qxb.js --auto
# Step 4: Verify quantum-x-builder is still active
gh api /repos/InfinityXOneSystems/quantum-x-builder/actions/permissions
Support
For issues or questions:
- Check this documentation
- Review script help:
node scripts/disable-workflows-except-qxb.js --help - Examine script source code for detailed comments
- Check GitHub API documentation: https://docs.github.com/en/rest/actions
Security Notes
- Never commit
GITHUB_TOKENto version control - Store tokens securely (use environment variables or secret managers)
- Rotate tokens regularly
- Use minimum required permissions
- Consider using GitHub Apps for production scenarios
- Audit which repositories were modified
Rollback Plan
If you need to undo changes:
- Manual Rollback: Re-enable Actions via GitHub UI for each repo
- Script Rollback: Modify script to set
enabled: trueand run again - Selective Rollback: Use interactive mode with an "enable" variant
License
This script is part of the quantum-x-builder project and follows the same license.