Files
codechecker-analysis-action/src/store-pre.sh
Whisperity 14d6da98f7 Revert "fix: Use user/repo/branch format"
This reverts commit d0c913fdc3.

As Ericsson/CodeChecker#3536 got merged, we can return to using `:`.
2021-12-24 13:25:50 +01:00

48 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
if [[ -z "$IN_STORE_URL" ]]; then
echo "::error title=Configuration error::Uploading results to a server was enabled, but the upload URL is not configured."
exit 1
fi
if [[ ! -z "$IN_STORE_USERNAME" && ! -z "$IN_STORE_PASSWORD" ]]; then
echo "Configuring credentials..."
cat <<EOF > ~/.codechecker.passwords.json
{
"client_autologin": true,
"credentials": {
"$IN_STORE_URL": "$IN_STORE_USERNAME:$IN_STORE_PASSWORD"
}
}
EOF
chmod 0600 ~/.codechecker.passwords.json
fi
if [[ ! -z "$IN_STORE_RUN_NAME" && "$IN_STORE_RUN_NAME" != "__DEFAULT__" ]]; then
echo "Using user-requested run name."
echo "::set-output name=RUN_NAME::$IN_STORE_RUN_NAME"
echo "::set-output name=RUN_TAG::"
echo "::set-output name=STORE_CONFIGURED::true"
exit 0
fi
if [[ "$GITHUB_REF_TYPE" == "branch" ]]; then
echo "Auto-generating run name for a BRANCH."
echo "::set-output name=RUN_NAME::$GITHUB_REPOSITORY: $GITHUB_REF_NAME"
echo "::set-output name=RUN_TAG::$GITHUB_SHA"
echo "::set-output name=STORE_CONFIGURED::true"
exit 0
elif [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
echo "Auto-generating run name for a TAG."
echo "::set-output name=RUN_NAME::$GITHUB_REPOSITORY tags"
echo "::set-output name=RUN_TAG::$GITHUB_REF_NAME"
echo "::set-output name=STORE_CONFIGURED::true"
exit 0
fi
echo "::notice title=Preparation for store::Failed to generate a run name. Implementation error?"
echo "::set-output name=STORE_CONFIGURED::false"