-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
32 lines (30 loc) · 903 Bytes
/
action.yml
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
name: 'Multiple Go Modules'
description: 'Run command in multiple repos'
inputs:
run:
description: "Command(s) to run"
required: true
working-directory:
description: "working directory"
required: false
runs:
using: "composite"
steps:
- shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
status=0
dirs=$(find . \( -name vendor -o -name '[._].*' -o -name node_modules \) -prune -o -name go.mod -print | sed 's:/go.mod$::')
len=$(echo "$dirs" | wc -l | tr -d ' ')
for dir in $dirs; do
pushd $dir > /dev/null
if [[ $len > 1 ]]; then echo "::group::$dir"; fi
(
${{ inputs.run }}
)
if [[ $len > 1 ]]; then echo "::endgroup::"; fi
s=$?
if [[ $s != 0 ]]; then status=$s; fi
popd > /dev/null
done
exit $status