Files
rocm-systems/projects/rdc/run_github_actions_locally.sh
T
Galantsev, Dmitrii 3f11f0e76b CI - Use vars instead of secrets
Change-Id: Ib917b8677c204a75bedcb345978f2b09216b115f
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>


[ROCm/rdc commit: b5272fb99c]
2024-11-26 11:17:50 -06:00

46 líneas
972 B
Bash
Archivo Ejecutable

#!/usr/bin/env bash
# This program runs github actions locally using 'act'
# All arguments given to this script are passed to act itself
set -eu
set -o pipefail
REMOTE_NAME="${REMOTE_NAME:-origin}"
CONTAINER="${CONTAINER:-ubuntu}"
# act will use this file if it exists for vars
VARS_FILE="${VARS_FILE:-act.secrets}"
if ! git remote | grep -q "$REMOTE_NAME"; then
echo "ERROR: Remote '$REMOTE_NAME' does not exist!"
echo "Set remote like so:
REMOTE_NAME=myremote $0"
exit 1
fi
if ! command -v act > /dev/null; then
echo "ERROR: 'act' not found!"
echo "Please install act from the link below:"
echo "https://github.com/nektos/act"
exit 1
fi
# build arguments array for act
args=(
--rm
--remote-name "$REMOTE_NAME"
--artifact-server-path /tmp/artifacts
-P "self-hosted=$CONTAINER"
)
if test -e "${VARS_FILE}"; then
args+=(--var-file "${VARS_FILE}")
fi
# trace
set -x
mkdir -p /tmp/artifacts
act "${args[@]}" "$@"