-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (31 loc) · 1.29 KB
/
check_env.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
name: check env conflicts
on:
push:
branches:
- '**'
jobs:
check_env_conflicts:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for env conflicts
run: |
# Extract variable names from both files
vars1=$(grep -oP '(?<=^)[^#=]+(?==)' .env.example | sort)
vars2=$(grep -oP '(?<=^)[^#=]+(?==)' .env.bridge.example | sort)
vars3=$(grep -oP '(?<=^)[^#=]+(?==)' .env.explorer.example | sort)
# Find conflicts (variables present in both files)
conflicts12=$(comm -12 <(echo "$vars1") <(echo "$vars2"))
conflicts13=$(comm -12 <(echo "$vars1") <(echo "$vars3"))
conflicts23=$(comm -12 <(echo "$vars2") <(echo "$vars3"))
# Combine all conflicts
all_conflicts=$(echo -e "${conflicts12}\n${conflicts13}\n${conflicts23}" | sort -u)
# Check if there are any conflicts
if [ -n "$all_conflicts" ]; then
echo "Conflicts found between .env.example, .env.bridge.example, and .env.explorer.example:"
echo "$all_conflicts"
exit 1
else
echo "No conflicts found between .env.example, .env.bridge.example, and .env.explorer.example"
fi