start nginx #103
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |