extension_auto_bump.yml

 1# Generated from xtask::workflows::extension_auto_bump
 2# Rebuild with `cargo xtask workflows`.
 3name: extension_auto_bump
 4on:
 5  push:
 6    branches:
 7    - main
 8    paths:
 9    - extensions/**
10    - '!extensions/test-extension/**'
11    - '!extensions/workflows/**'
12    - '!extensions/*.md'
13jobs:
14  detect_changed_extensions:
15    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
16    runs-on: namespace-profile-2x4-ubuntu-2404
17    steps:
18    - name: steps::checkout_repo
19      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
20      with:
21        clean: false
22        fetch-depth: 2
23    - id: detect
24      name: extension_auto_bump::detect_changed_extensions
25      run: |
26        COMPARE_REV="$(git rev-parse HEAD~1)"
27        CHANGED_FILES="$(git diff --name-only "$COMPARE_REV" "$GITHUB_SHA")"
28        # Detect changed extension directories (excluding extensions/workflows)
29        CHANGED_EXTENSIONS=$(echo "$CHANGED_FILES" | grep -oP '^extensions/[^/]+(?=/)' | sort -u | grep -v '^extensions/workflows$' || true)
30        # Filter out deleted extensions
31        EXISTING_EXTENSIONS=""
32        for ext in $CHANGED_EXTENSIONS; do
33            if [ -f "$ext/extension.toml" ]; then
34                EXISTING_EXTENSIONS=$(printf '%s\n%s' "$EXISTING_EXTENSIONS" "$ext")
35            fi
36        done
37        CHANGED_EXTENSIONS=$(echo "$EXISTING_EXTENSIONS" | sed '/^$/d')
38        if [ -n "$CHANGED_EXTENSIONS" ]; then
39            EXTENSIONS_JSON=$(echo "$CHANGED_EXTENSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
40        else
41            EXTENSIONS_JSON="[]"
42        fi
43        # Filter out newly added extensions
44        FILTERED="[]"
45        for ext in $(echo "$EXTENSIONS_JSON" | jq -r '.[]'); do
46            if git show HEAD~1:"$ext/extension.toml" >/dev/null 2>&1; then
47                FILTERED=$(echo "$FILTERED" | jq -c --arg e "$ext" '. + [$e]')
48            fi
49        done
50        echo "changed_extensions=$FILTERED" >> "$GITHUB_OUTPUT"
51    outputs:
52      changed_extensions: ${{ steps.detect.outputs.changed_extensions }}
53    timeout-minutes: 5
54  bump_extension_versions:
55    needs:
56    - detect_changed_extensions
57    if: needs.detect_changed_extensions.outputs.changed_extensions != '[]'
58    permissions:
59      actions: write
60      contents: write
61      issues: write
62      pull-requests: write
63    strategy:
64      matrix:
65        extension: ${{ fromJson(needs.detect_changed_extensions.outputs.changed_extensions) }}
66      fail-fast: false
67      max-parallel: 1
68    uses: ./.github/workflows/extension_bump.yml
69    secrets:
70      app-id: ${{ secrets.ZED_ZIPPY_APP_ID }}
71      app-secret: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
72    with:
73      working-directory: ${{ matrix.extension }}
74      force-bump: false
75concurrency:
76  group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
77  cancel-in-progress: true
78defaults:
79  run:
80    shell: bash -euxo pipefail {0}