File tree Expand file tree Collapse file tree 2 files changed +46
-31
lines changed Expand file tree Collapse file tree 2 files changed +46
-31
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash -e
22
3+ SOURCE_DIR=$( dirname " $0 " )
4+
35# If BUILD_ALL is true, then we want to generate lists with all packages regardless of changes
46if [[ $BUILD_ALL = true ]]; then
5- PACKAGE_LIST =$( yarn workspaces list -R --json )
7+ CHANGED_PACKAGES_AND_ADAPTERS =$( " $SOURCE_DIR / list-packages-adapters.sh " )
68else
7- PACKAGE_LIST =$( yarn workspaces list -R --json --since= $UPSTREAM_BRANCH )
9+ CHANGED_PACKAGES_AND_ADAPTERS =$( " $SOURCE_DIR / list-packages-adapters.sh " " $UPSTREAM_BRANCH " )
810fi
911
10- # The yarn command used above will give us a list of the packages that have changed (including changes by dependencies)
11- CHANGED_PACKAGES=$(
12- echo $PACKAGE_LIST \
13- | jq -cs ' .' \
14- | jq -cr ' [.[] | select(.location | startswith("packages"))]' \
15- )
16-
17- # Add versions to the packages
18- CHANGED_PACKAGES=$(
19- for package in $( echo $CHANGED_PACKAGES | jq -c ' .[]' ) ; do
20- location=$( echo $package | jq -r ' .location' )
21- version=$( jq ' .version' $location /package.json)
22- echo $package | jq -c " .version = $version "
23- done | jq -cs ' .'
24- )
25-
26- # Build a list to use with matrix strategies
27- CHANGED_ADAPTERS=$(
28- echo $CHANGED_PACKAGES \
29- | jq -cr ' {
30- adapter: [
31- .[]
32- | select(
33- .location
34- | startswith("packages/sources") or startswith("packages/composites") or startswith("packages/targets"))
35- | .shortName = (.name | match("@chainlink/(.*)-adapter").captures[0].string)
36- ]
37- }'
38- )
12+ CHANGED_PACKAGES=$( echo $CHANGED_PACKAGES_AND_ADAPTERS | jq -c ' .packages' )
13+ CHANGED_ADAPTERS=$( echo $CHANGED_PACKAGES_AND_ADAPTERS | jq -c ' {adapter: .adapters}' )
3914
4015echo " CHANGED_PACKAGES=$CHANGED_PACKAGES " >> $GITHUB_OUTPUT
4116echo " CHANGED_ADAPTERS=$CHANGED_ADAPTERS " >> $GITHUB_OUTPUT
Original file line number Diff line number Diff line change 1+ #! /bin/bash -e
2+
3+ SOURCE_DIR=" $( dirname " $0 " ) "
4+
5+ UPSTREAM_BRANCH=" ${1:- } "
6+
7+ if [[ -z " $UPSTREAM_BRANCH " ]]; then
8+ PACKAGE_LIST=$( yarn workspaces list -R --json)
9+ else
10+ PACKAGE_LIST=$( yarn workspaces list -R --json --since=$UPSTREAM_BRANCH )
11+ fi
12+
13+ # The yarn command used above will give us a list of the packages that have changed (including changes by dependencies)
14+ CHANGED_PACKAGES=$(
15+ echo $PACKAGE_LIST \
16+ | jq -cs ' .' \
17+ | jq -cr ' [.[] | select(.location | startswith("packages"))]' \
18+ )
19+
20+ # Add versions to the packages
21+ CHANGED_PACKAGES=$(
22+ for package in $( echo $CHANGED_PACKAGES | jq -c ' .[]' ) ; do
23+ location=$( echo $package | jq -r ' .location' )
24+ version=$( jq ' .version' $location /package.json)
25+ echo $package | jq -c " .version = $version "
26+ done | jq -cs ' .'
27+ )
28+
29+ # Build a list to use with matrix strategies
30+ echo $CHANGED_PACKAGES \
31+ | jq -cr ' {
32+ packages: .,
33+ adapters: [
34+ .[]
35+ | select(
36+ .location
37+ | startswith("packages/sources") or startswith("packages/composites") or startswith("packages/targets"))
38+ | .shortName = (.name | match("@chainlink/(.*)-adapter").captures[0].string)
39+ ]
40+ }'
You can’t perform that action at this time.
0 commit comments