Skip to content

build-workflow.sh: do not include variables that should not be exported

Dean Jackson requested to merge vitorgalvao:patch-1 into master

Created by: vitorgalvao

I use a custom zsh function to package, commit, push to the repo, open Packal, copy message to clipboard ready to paste to the forum, etc, when I make a workflow update.

Just now it hit me there’s a Don't Export option for Workflow Environment Variables. That means Alfred knows not to export them, but zipping won’t take that into account. Made a quick test and confirmed that is indeed the case. Then I remembered seeing a script of yours (this one) that packaged workflows (though my memory failed me on the language, as I though the script itself was python). Came looking to see if you had solved that or it had escaped us both.

A few modifications to my my function later, arrived at something similar to this (changed here to better fit with the style of your script).

Quite simply, it:

  1. Checks if info.plist has variablesdontexport.
  2. If it doesn’t, proceed as usual.
  3. If it does, copy the entire workflow to a temporary directory (we’ll make changes to the info.plist and don’t want to do them on our current one).
  4. Check every variable in variablesdontexport and set them to empty values (we don’t want to delete them, else the reference would be lost as well).

I’ll likely make a post on the forum briefly on this, but wanted to go ahead and submit this to you as well.

Merge request reports