Install the Apps Script with GitHub Actions
The freehand script is an Apps Script that runs in your Google account. It sends tagged Google Docs, adds the Freehand panel to every Doc, answers your AI’s requests, and watches your device’s folders, with your laptop shut. Google keeps Apps Script outside git, so something has to push it. This guide sets up a small workflow in a repo of yours that installs the release you name.
If you’d rather not use GitHub, you can paste the release’s files instead. The result is the same.
Before you start
Section titled “Before you start”- A private repo of yours. The workflow holds a login to your Google account, so keep the repo private.
- The Google account the scripts run as, the one your device syncs to, or one that can edit your device’s folder and your
freehandfolder. - Node 22.18 or later on your computer, for the one-time login.
- A release of Freehand to install. Releases are at github.com/savdevarney/freehand/releases. This guide uses
v0.2.0.
1. Turn on the Apps Script API
Section titled “1. Turn on the Apps Script API”In the Google account, open script.google.com/home/usersettings and turn the Apps Script API on. You do this once.
2. Make the script, once
Section titled “2. Make the script, once”The workflow updates a script that exists. For the first install you make it by one of two routes:
-
Paste it. Make a project named
freehandat script.google.com and paste the release’sfreehand-Code.jsandfreehand-appsscript.json, as in the script’s own install steps. -
From a clone. Run these in a clone of Freehand:
Terminal window npx clasp loginnpm run scripts:createThe second command makes the project in your account and pushes the code.
Then open the project, go to Project Settings, and copy its Script ID.
3. Get a clasp login for CI
Section titled “3. Get a clasp login for CI”On your computer, sign in as the Google account the scripts run as:
npx clasp loginThat writes ~/.clasprc.json. Treat its contents like a password.
4. Add the workflow to your repo
Section titled “4. Add the workflow to your repo”Copy script/install.example.yml into your private repo as .github/workflows/install-freehand.yml. It calls Freehand’s shared workflow:
jobs: install: secrets: inherit with: version: v0.2.0 time-zone: ${{ vars.SCRIPT_TIME_ZONE || 'UTC' }}The @v0.2.0 after uses: and the version: line name the same release. Keep them the same.
5. Add the secrets
Section titled “5. Add the secrets”In the repo, open Settings, Secrets and variables, Actions and add:
| Name | Kind | What it is |
|---|---|---|
CLASPRC_JSON |
secret | The contents of ~/.clasprc.json from step 3 |
FREEHAND_SCRIPT_ID |
secret | The freehand script’s ID from step 2 |
GOOGLE_DOC_IMAGES_SCRIPT_ID |
secret, optional | The ID of the google-doc-images script, if you use it |
SCRIPT_TIME_ZONE |
variable, optional | Your time zone, for example Europe/Paris. The default is UTC |
6. Run it
Section titled “6. Run it”Push the workflow file to main, or open the Actions tab, pick Install Freehand and choose Run workflow. The run replaces the script’s code and manifest with the release’s.
7. Finish in Google
Section titled “7. Finish in Google”An install pushes code only. Do these once in the script editor:
- Project Settings, Script properties: add
FREEHAND_FOLDER_ID, the ID of yourfreehandfolder in Drive (the last part of its web address). - Run
setup. Pick it in the function list, press Run, and allow access when Google asks. It makesfreehand/inbox/and installs the every-minute trigger. - Turn on the panel: Deploy, Test deployments, Google Workspace Add-on, Install. Open any Google Doc and Freehand is in the side panel.
Check that it works
Section titled “Check that it works”In Drive, open a Doc’s Details and add the line freehand: proof to its description. Within five minutes the proof is in your device’s proofs folder, and the line reads freehand: proof 1 sent <date>.
Move to a newer release
Section titled “Move to a newer release”Change the version in both places in install-freehand.yml and push. The workflow installs the new release. Your script properties, triggers and the panel’s install stay.
If something goes wrong
Section titled “If something goes wrong”- The run can’t find the script. Check
FREEHAND_SCRIPT_IDis the Script ID, not the deployment ID. - Freehand is private (a fork, say). Add a
FREEHAND_TOKENsecret: a fine-grained token that can read its contents.