From 08ee40115c4894e30fe73b53d7bff27d94592625 Mon Sep 17 00:00:00 2001 From: Jon Vivian <2586037+4leite@users.noreply.github.com> Date: Wed, 5 Jun 2024 14:42:17 +1200 Subject: [PATCH] improve changed packages action (#148) --- .github/workflows/call-changed-packages.yml | 4 ++-- scripts/changed.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 scripts/changed.sh diff --git a/.github/workflows/call-changed-packages.yml b/.github/workflows/call-changed-packages.yml index 7a93c809..8144731f 100644 --- a/.github/workflows/call-changed-packages.yml +++ b/.github/workflows/call-changed-packages.yml @@ -53,7 +53,7 @@ jobs: # 3. We specify the .github/ folder as a dependency here. Just to be safe, if workflows changed, we use that to mean everything has changes pending... to force redeploys run: | echo 'result<> $GITHUB_OUTPUT - echo "$(npx -y turbo build --dry-run=json --filter=...[$TURBO_REF_FILTER] --global-deps=.github/*)" >> $GITHUB_OUTPUT + echo "$(sh ./scripts/changed.sh $TURBO_REF_FILTER)" >> $GITHUB_OUTPUT echo 'CHANGESET_DELIMITER' >> $GITHUB_OUTPUT - name: skip @@ -65,7 +65,7 @@ jobs: id: output-changed-packages run: | echo 'changed_packages<> $GITHUB_OUTPUT - echo "${{ github.head_ref == 'changeset-release/main' && '[]' || toJSON(fromJSON(steps.changeset.outputs.result).packages) }}" >> $GITHUB_OUTPUT + echo "${{ github.head_ref == 'changeset-release/main' && '[]' || steps.changeset.outputs.result }}" >> $GITHUB_OUTPUT echo 'CHANGED_PACKAGES_DELIMITER' >> $GITHUB_OUTPUT # Boolean check for specific package sets diff --git a/scripts/changed.sh b/scripts/changed.sh new file mode 100644 index 00000000..b42f89d8 --- /dev/null +++ b/scripts/changed.sh @@ -0,0 +1 @@ +npx -y turbo build --dry-run=json --filter=...[$1] --global-deps=.github/* | node -p 'JSON.parse(fs.readFileSync(0)).packages' \ No newline at end of file