Skip to content
refresh-cw

GitHub Action

Glitch Project Sync

v3.0.1 Latest version

Glitch Project Sync

refresh-cw

Glitch Project Sync

Sync the contents of your GitHub repository with your project on Glitch

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Glitch Project Sync

uses: kanadgupta/glitch-sync@v3.0.1

Learn more about this action in kanadgupta/glitch-sync

Choose a version

Glitch Sync From GitHub

Remix on Glitch

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:

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.