This guide will help you set up a GitHub Action workflow that automatically converts Quantumult X scripts to Surge and Loon formats using Script Hub.
- A GitHub repository for your scripts
- Basic understanding of GitHub Actions
- Your Quantumult X scripts organized in a specific folder
For this workflow to function properly, organize your repository like this:
your-repository/
├── .github/
│ └── workflows/
│ └── convert-scripts.yml
├── QuantumultX/
│ ├── script1.js
│ ├── script2.js
│ └── ...
├── Surge/ (will be auto-created)
├── Loon/ (will be auto-created)
└── README.md
-
Create the workflow file:
- Create a directory
.github/workflows/
in your repository if it doesn't exist - Copy the
convert-scripts.yml
workflow file into this directory
- Create a directory
-
Organize your scripts:
- Place all your Quantumult X scripts in a folder named
QuantumultX
- Make sure your scripts follow the proper Quantumult X format
- Place all your Quantumult X scripts in a folder named
-
Push the changes to your repository:
git add .github/workflows/convert-scripts.yml git commit -m "Add script conversion workflow" git push
-
Trigger the workflow: The workflow will automatically run when:
- You push changes to Quantumult X scripts in the main branch
- A pull request is made that changes Quantumult X scripts
- You manually trigger it from the Actions tab in your repository
- When triggered, the workflow checks out your repository code
- It sets up Node.js and installs the Script Hub CLI
- Creates output directories for Surge and Loon if they don't exist
- Converts each JavaScript file from the QuantumultX folder to both Surge and Loon formats
- Commits and pushes the converted scripts back to your repository
If the conversion fails:
- Check that your Quantumult X scripts are valid and properly formatted
- Verify the Script Hub CLI is properly installed and working
- Check the GitHub Actions logs for specific error messages
To run the workflow manually:
- Go to your repository on GitHub
- Click on the "Actions" tab
- Select the "Convert Scripts" workflow
- Click "Run workflow"
- Select the branch and click "Run workflow"
You can customize the workflow by:
- Changing the trigger conditions
- Modifying the input and output directories
- Adding additional conversion formats if supported by Script Hub