-
Notifications
You must be signed in to change notification settings - Fork 0
/
act.sh
executable file
·44 lines (30 loc) · 836 Bytes
/
act.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
#
# run the act utility (which runs the Github Actions in the .github directory locally)
#
# Mac OS X:
# - Install "act" with "brew install act"
#
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
act_bin=""
function checkAct() {
local linux_image="ghcr.io/catthehacker/ubuntu:full-latest"
cd "${SCRIPT_DIR}" || return $?
echo "========================== check environment"
dockr image pull "${linux_image}"
echo "-P ubuntu-latest=${linux_image}" > "${SCRIPT_DIR}/.actrc"
act_bin="$(command -v act)"
return 0
}
function execAct() {
echo "Jobs: (use --job <job name> to select just one of these)"
"${act_bin}" -l
# shellcheck disable=SC2068
set -x
# shellcheck disable=SC2068
exec "${act_bin}" $@
}
checkAct || exit 1
# shellcheck disable=SC2068
execAct $@
exit $?