Skip to content

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.

  • 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 freehand folder.
  • 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.

In the Google account, open script.google.com/home/usersettings and turn the Apps Script API on. You do this 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 freehand at script.google.com and paste the release’s freehand-Code.js and freehand-appsscript.json, as in the script’s own install steps.

  • From a clone. Run these in a clone of Freehand:

    Terminal window
    npx clasp login
    npm run scripts:create

    The 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.

On your computer, sign in as the Google account the scripts run as:

Terminal window
npx clasp login

That writes ~/.clasprc.json. Treat its contents like a password.

Copy script/install.example.yml into your private repo as .github/workflows/install-freehand.yml. It calls Freehand’s shared workflow:

jobs:
install:
uses: savdevarney/freehand/.github/workflows/[email protected]
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.

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

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.

An install pushes code only. Do these once in the script editor:

  1. Project Settings, Script properties: add FREEHAND_FOLDER_ID, the ID of your freehand folder in Drive (the last part of its web address).
  2. Run setup. Pick it in the function list, press Run, and allow access when Google asks. It makes freehand/inbox/ and installs the every-minute trigger.
  3. Turn on the panel: Deploy, Test deployments, Google Workspace Add-on, Install. Open any Google Doc and Freehand is in the side panel.

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>.

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.

  • The run can’t find the script. Check FREEHAND_SCRIPT_ID is the Script ID, not the deployment ID.
  • Freehand is private (a fork, say). Add a FREEHAND_TOKEN secret: a fine-grained token that can read its contents.