File tree Expand file tree Collapse file tree 1 file changed +35
-3
lines changed
Expand file tree Collapse file tree 1 file changed +35
-3
lines changed Original file line number Diff line number Diff line change 2121 id : plugin
2222 run : |
2323 git fetch --prune --unshallow
24- # Get only files within plugin subdirectories
25- plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/[^/]\+/' | head -1 | cut -d/ -f2)
26- echo "slug=$plugin" >> $GITHUB_OUTPUT
24+
25+ # Get changed files in plugins subdirectories
26+ CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/[^/]\+/' || true)
27+
28+ if [ -z "$CHANGED_FILES" ]; then
29+ echo "No plugin files changed"
30+ exit 1
31+ fi
32+
33+ # Extract plugin names from both old and new paths
34+ PLUGINS=()
35+ for file in $CHANGED_FILES; do
36+ plugin=$(echo $file | cut -d/ -f2)
37+ PLUGINS+=("$plugin")
38+ done
39+
40+ # Get unique plugin names
41+ UNIQUE_PLUGINS=($(printf '%s\n' "${PLUGINS[@]}" | sort -u))
42+
43+ # Find the first plugin that actually exists
44+ PLUGIN_SLUG=""
45+ for plugin in "${UNIQUE_PLUGINS[@]}"; do
46+ if [ -d "plugins/$plugin" ]; then
47+ PLUGIN_SLUG="$plugin"
48+ echo "Found existing plugin directory: $PLUGIN_SLUG"
49+ break
50+ fi
51+ done
52+
53+ if [ -z "$PLUGIN_SLUG" ]; then
54+ echo "No valid plugin directory found"
55+ exit 1
56+ fi
57+
58+ echo "slug=$PLUGIN_SLUG" >> $GITHUB_OUTPUT
2759
2860 - name : Create plugin artifact
2961 uses : ./.github/actions/create-plugin-artifact
You can’t perform that action at this time.
0 commit comments