6commit_sha=$(git rev-parse HEAD)
7echo "COMMIT_SHA $commit_sha"
8
9echo "GIT_BRANCH $git_branch"10
11git_tree_status=$(git diff-index --quiet HEAD -- && echo 'Clean' || echo 'Modified')
12echo "GIT_TREE_STATUS $git_tree_status"
62echo "Uploading asset... "
63
64# Construct url
65GH_ASSET="https://uploads.github.com/repos/$owner/$repo/releases/$id/assets?name=$(basename "$filename")"66
67echo "$GH_ASSET"
68
38GH_API="https://api.github.com"
39GH_REPO="$GH_API/repos/$owner/$repo"
40GH_TAGS="$GH_REPO/releases/tags/$tag"
41AUTH="Authorization: token $github_api_token"42# skipcq: SH-2034
43export WGET_ARGS="--content-disposition --auth-no-challenge --no-cookie"
44# skipcq: SH-2034
37# Define variables.
38GH_API="https://api.github.com"
39GH_REPO="$GH_API/repos/$owner/$repo"
40GH_TAGS="$GH_REPO/releases/tags/$tag"41AUTH="Authorization: token $github_api_token"
42# skipcq: SH-2034
43export WGET_ARGS="--content-disposition --auth-no-challenge --no-cookie"
36
37# Define variables.
38GH_API="https://api.github.com"
39GH_REPO="$GH_API/repos/$owner/$repo"40GH_TAGS="$GH_REPO/releases/tags/$tag"
41AUTH="Authorization: token $github_api_token"
42# skipcq: SH-2034
A variable has been referenced that is not known to have been assigned earlier in the script. Double-check that the variable has indeed been assigned before being referenced and that it does not contain any typos.
Note: This issue only triggers for variables with lowercase characters in their name (foo
and kFOO
but not FOO
) due to the standard convention of using lowercase variable names for unexported, local variables.
The checker intentionally does not attempt to figure out runtime or dynamic assignments like with source "$(date +%F).sh"
or eval var=value
.
If you know for a fact that the variable is set, you can use ${var:?}
to fail if the variable is unset (or empty), initialize it to a default value if uninitialized with : "${var:=}"
, or explicitly initialize/declare it with var=""
or declare var
. You can also disable this issue by using a // skipcq: SH-2154
pragma.
POSIX - Parameter expansion: * https://stackoverflow.com/a/16753536/2309247 * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3chap02.html#tag180602