Environment variables

The different steps can add variables to the context, which are exposed to the scripts as environment variables. All of these are prefixed with GW_ to avoid collisions. The second part usually identifies the specific trigger, check or action.

A good way to debug environment variables is to print the variables with -s "printenv".

Trigger variables #

These are the variables that are exposed from the trigger, which can be scheduled trigger or an HTTP endpoint.

Variable nameExampleNotes
GW_TRIGGER_NAMESCHEDULE, HTTPThe identifier of the trigger.
GW_HTTP_METHODGET, POSTThe HTTP method that was called.
GW_HTTP_URL/, /triggerThe HTTP URL that was called.
GW_SCHEDULE_DELAY1m, 1d, 1wThe delay between two scheduled checks.

Check variables #

These are the variables that are exposed from the check, which currently is always git.

Variable nameExampleNotes
GW_CHECK_NAMEGITThe identifier of the check.
GW_GIT_BEFORE_COMMIT_SHAacfd4f88da199...The SHA of the commit before the pull.
GW_GIT_BEFORE_COMMIT_SHORT_SHAacfd4f8The 7-character short hash of the commit.
GW_GIT_BRANCH_NAMEmainThe name of the branch, that the repo is on.
GW_GIT_COMMIT_SHAacfd4f88da199...The SHA of the commit after the pull.
GW_GIT_COMMIT_SHORT_SHAacfd4f8The 7-character short hash of the commit.
GW_GIT_REF_NAMErefs/heads/main, refs/tags/v1.0The full name of the current git ref.
GW_GIT_REF_TYPEbranch, tagThe type of the ref we are currently on.
GW_GIT_REMOTE_NAMEoriginThe name of the remote used.
GW_GIT_REMOTE_URLgit@github.com:daniel7grant/gw.gitThe URL to the git remote.

Action variables #

These are the variables added by the action, which is script or process.

Variable nameExampleNotes
GW_ACTION_NAMESCRIPT, PROCESSThe identifier of the action.
GW_DIRECTORY/src/http/gwThe absolute path to the current directory.