Skip to content

INFRA-785 - switch publish-containers.yml to shared workflow #10127

INFRA-785 - switch publish-containers.yml to shared workflow

INFRA-785 - switch publish-containers.yml to shared workflow #10127

name: MacawUI migration
on:
pull_request:
types:
- opened
- labeled
- edited
- synchronize
jobs:
current_state:
runs-on: ubuntu-latest
name: "Calculate current state"
outputs:
main_statistics: ${{ steps.store_import_stats.outputs.MAIN_STATISTICS }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install deps
run: |
pnpm install
- name: Store import stats
id: store_import_stats
run: |
stats=$(pnpm exec depcruise --config .dependency-cruiser.js src --output-type json | jq ".summary.info")
echo "Statistics on main branch: ${stats}"
echo "MAIN_STATISTICS=${stats}" >> $GITHUB_OUTPUT
check_migation_status:
runs-on: ubuntu-latest
name: "Migration check"
needs: current_state
if: ${{ !contains( github.event.pull_request.labels.*.name, 'skip macaw migration check') }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install deps
run: |
pnpm install
- name: "Calculate stats"
env:
latest: ${{ needs.current_state.outputs.main_statistics }}
run: |
current=$(pnpm exec depcruise --config .dependency-cruiser.js src --output-type json | jq ".summary.info")
difference=$(( $current - $latest ))
echo "Imports in main: ${latest}"
echo "Incoming imports: ${current}"
echo "Difference: ${difference}"
echo "IMPORT_DIFFERENCE=${difference}" >> $GITHUB_ENV
- name: "MacawUI regression reported"
if: ${{ env.IMPORT_DIFFERENCE > 0 }}
run: |
echo "Regression detected: +${{ env.IMPORT_DIFFERENCE }} imports"
exit 1
- name: "MacawUI migration progress"
if: ${{ env.IMPORT_DIFFERENCE <= 0 }}
run: |
echo "Progress by: ${{ env.IMPORT_DIFFERENCE }} imports"
exit 0