-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
61 lines (57 loc) · 1.91 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: "Prepare MU Plugins"
description: ""
inputs:
path:
description: "Where dependencies should be copied to"
required: true
git-token:
description: "GIT Token to use when checking out and commiting"
required: true
mu-repo:
description: "The MU Plugins repo"
required: false
default: "saucal/saucal-mu-plugins-built"
mu-branch:
description: "The MU Plugins repo branch"
required: false
default: "main"
add-mu-plugins:
description: "Whether or not to add our MU-Plugins"
required: false
default: "auto"
mu-plugins-path:
description: "The path to use for MU-Plugins"
required: false
default: "mu-plugins"
runs:
using: "composite"
steps:
- name: Check if we need MU-Plugins
id: vars
shell: bash
run: |
if [ "${{ inputs.add-mu-plugins }}" == "auto" ]; then
if [ -d "${{ inputs.path }}/client-mu-plugins" ] && [ ! -d "${{ inputs.path }}/vip-config" ]; then
echo "do_add=true" >> $GITHUB_OUTPUT
else
echo "do_add=false" >> $GITHUB_OUTPUT
fi
else
echo "do_add=${{ inputs.add-mu-plugins }}" >> $GITHUB_OUTPUT
fi
mu_plugins_path=${{ inputs.mu-plugins-path }}
mu_plugins_path=${mu_plugins_path#"/"}
mu_plugins_path=${mu_plugins_path%"/"}
echo "mu_plugins_path=$mu_plugins_path" >> $GITHUB_OUTPUT
- name: Add MU Plugins
if: ${{ steps.vars.outputs.do_add == 'true' }}
uses: saucal/action-checkout-extended@v2
with:
token: ${{ inputs.git-token }}
path: "${{ inputs.path }}/${{ steps.vars.outputs.mu_plugins_path }}"
repo: ${{ inputs.mu-repo }}
use: ${{ inputs.mu-branch }}
- name: Cleanup GIT files from MU Plugins directory
if: ${{ steps.vars.outputs.do_add == 'true' }}
shell: bash
run: rm -rf "${{ inputs.path }}/${{ steps.vars.outputs.mu_plugins_path }}/.git"