-
Notifications
You must be signed in to change notification settings - Fork 2.2k
53 lines (52 loc) · 2.19 KB
/
callable-get-package-list.yml
File metadata and controls
53 lines (52 loc) · 2.19 KB
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
45
46
47
48
49
50
51
52
53
name: Capture Package Names List to Outputs
on:
workflow_call:
outputs:
packages:
description: The json encoded package list
value: ${{ jobs.get-package-list.outputs.packages }}
nativePackages:
description: The json encoded native package list
value: ${{ jobs.get-package-list.outputs.nativePackages }}
jobs:
get-package-list:
name: Get packages list
runs-on: ubuntu-latest
steps:
- name: Checkout AmplifyJs
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
id: cache-package-list
with:
path: |
**/package-list.json
key: ${{ runner.os }}-package-list-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-package-list-
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- name: Install
if: steps.cache-package-list.outputs.cache-hit != 'true'
run: yarn
shell: bash
# Need the repo checked out in order to read the file
- name: Dump Package List
if: steps.cache-package-list.outputs.cache-hit != 'true'
run: |
# Get all workspaces and filter out private packages (examples and scripts)
# This matches Lerna's behavior with "command.run.private: false"
yarn workspaces info --json 2>&1 | sed -n '/^{/,/^}/p' | jq -c '
to_entries |
map({name: .key, path: .value.location}) |
map(select(.path | (contains("/example") or startswith("scripts/")) | not))
' > package-list.json
- name: Get Package List
id: get_package_list
run: |
echo "packages=$(cat package-list.json)" >> $GITHUB_OUTPUT
# temporarily filter to only packages with runnable tests
echo "nativePackages=$(jq -c 'map(select(.name | test("rtn-passkeys|react-native")))' package-list.json)" >> $GITHUB_OUTPUT
outputs:
packages: ${{ steps.get_package_list.outputs.packages }}
# todo: expand native package list as other tests are made runnable
nativePackages: ${{ steps.get_package_list.outputs.nativePackages }}