-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yaml
75 lines (68 loc) · 2.67 KB
/
action.yaml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: 'Firebase Emulator Action'
description: 'Starts the Firebase Emulator Suite'
author: 'Invertase'
inputs:
firebase-tools-version:
description: 'Firebase Tools version to install'
required: false
default: 'latest'
emulators:
description: 'Comma-separated list of Firebase emulators to start (e.g., auth,firestore,functions)'
required: false
default: 'auth,firestore,functions,storage,database'
project-id:
description: 'The project ID to use for the Firebase Emulator Suite'
required: false
default: 'test-project'
max-retries:
description: 'The maximum number of retries to attempt when starting the Firebase Emulator Suite'
required: false
default: '3'
max-checks:
description: 'The maximum number of checks to attempt when starting the Firebase Emulator Suite'
required: false
default: '60'
wait-time:
description: 'The time to wait (in seconds) between checks when starting the Firebase Emulator Suite'
required: false
default: '1'
check-port:
description: 'The port to check for when starting the Firebase Emulator Suite'
required: false
default: '8080' # Firestore emulator default port
runs:
using: "composite"
steps:
- name: Install Firebase Tools
shell: bash
run: |
sudo npm i -g firebase-tools@${{ inputs.firebase-tools-version }}
- name: Check and strip spaces from emulators input
shell: bash
run: |
EMULATORS="${{ inputs.emulators }}"
# Check if there are spaces around the commas
if [[ "$EMULATORS" =~ [[:space:]] ]]; then
echo "Spaces detected in emulators list, stripping spaces..."
# Remove spaces around commas
EMULATORS=$(echo "$EMULATORS" | tr -s ' ' ',')
EMULATORS=$(echo "$EMULATORS" | tr -s ',' ',') # Ensure no accidental extra commas
else
echo "No spaces detected in emulators list."
fi
# Trim leading and trailing spaces and commas
EMULATORS=$(echo "$EMULATORS" | sed 's/^[[:space:],]*//;s/[[:space:],]*$//')
# Output the result for debugging purposes
echo "Stripped emulators list: $EMULATORS"
echo "EMULATORS=$EMULATORS" >> $GITHUB_ENV # Store stripped emulators in env
- name: Start Firebase Emulator
shell: bash
run: |
chmod +x ${{ github.action_path }}/start-firebase-emulator.sh
${{ github.action_path }}/start-firebase-emulator.sh \
${{ inputs.emulators }} \
${{ inputs.project-id }} \
${{ inputs.max-retries }} \
${{ inputs.max-checks }} \
${{ inputs.wait-time }} \
${{ inputs.check-port }}