Skip to content

ci: 👷 run release job only if changes are given #2

ci: 👷 run release job only if changes are given

ci: 👷 run release job only if changes are given #2

name: Get Changed Packages
on:
push:
branches:
- master
workflow_call:
outputs:
CHANGED_PACKAGES:
value: ${{ jobs.analyse-changed-packages.outputs.changedPackages }}
jobs:
analyse-changed-packages:
runs-on: ubuntu-latest
outputs:
changedPackages: ${{ steps.changed-packages.outputs.CHANGED_PACKAGES }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- run: |
SINCE=$(git rev-list --tags --max-count=1)
echo SINCE=$SINCE >> $GITHUB_OUTPUT
echo SINCE=$SINCE
id: since
- run: |
pnpm list -r --json --filter "...[$SINCE]" | jq '[.[] | select(.private == false) | {name, path}]' > ./tmp.json
CHANGED_PACKAGES=$(jq '[.[] | .name]' ./tmp.json)
echo CHANGED_PACKAGES=$CHANGED_PACKAGES >> $GITHUB_OUTPUT
echo CHANGED_PACKAGES=$CHANGED_PACKAGES
id: changed-packages
env:
SINCE: ${{ steps.since.outputs.SINCE }}