glitch-sync
glitch-sync copied to clipboard
Sync your GitHub repository with Glitch via GitHub Actions! 🎏
Glitch Sync From GitHub
This action uses the Glitch API to export your GitHub repository to your Glitch project.
Requirements
- A GitHub repository
- An existing Glitch project
Inputs

auth-token
Required The Authorization
request header used when clicking the Import from GitHub button (Tools > Import and Export > Import from GitHub) from within your Glitch project (see screenshot to the right). The only way that I know to obtain this is to look at your Network tab in your browser and capture the contents of the Authorization
request header when the POST
request to https://api.glitch.com/project/githubImport is made.
[!IMPORTANT] Glitch rotates this token regularly so you'll need to ensure it stays updated in order for this tool to work properly. In my testing, the token rotates roughly once a month.
project-id
Required The ID of your Glitch Project. You can obtain this via one of two ways:
- Grabbing the value the
projectId
query parameter of the aforementionedPOST
request to https://api.glitch.com/project/githubImport - Logging
process.env.PROJECT_ID
in your Glitch project. More info: https://glitch.happyfox.com/kb/article/30-variables/
path
Optional A relative path to a specific folder to import. If not passed, it will import the entirety of the GitHub repository.
repo
Optional The GitHub repository to sync, using the format owner/repo
(e.g., octocat/Hello-World
). If not passed, the current GitHub repository will be synced.
Example usage
See .github/workflows/ci.yml
for several full examples.
I strongly recommend adding the inputs as encrypted secrets instead of passing them directly into your action file! Here are the GitHub docs on how to do this.
uses: kanadgupta/glitch-sync@main
with:
auth-token: '${{ secrets.authToken }}'
project-id: '${{ secrets.projectId }}'
path: 'dist' # optional
Disclaimer
I am not an employee of Glitch (merely a user)! This repository is not endorsed by Glitch and does not use a documented public API endpoint (and the endpoint can be kind of flaky to be honest). The endpoint may change at anytime and break this workflow.