feat: deprecate hopic bilingual #54
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: Validate config-control Namespace | |
on: | |
pull_request: | |
paths: | |
- 'dns-records/*.yaml' | |
jobs: | |
validate-namespace: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install yq | |
uses: mikefarah/yq@v4 | |
- name: Validate namespace | |
id: validate-namespace | |
run: | | |
yaml_files=() | |
EXPECTED_NAMESPACE='dns' | |
error_occurred=0 | |
# Find yml/yaml files that have been changed | |
yaml_files=($(git diff --name-only HEAD^..HEAD | grep -E '^dns-records/.*\.ya?ml$')) | |
# Check if there are any YAML files to process | |
if [ ${#yaml_files[@]} -eq 0 ]; then | |
echo -e "\nNo YAML files to process after filtering. Exiting cleanly." | |
exit 0 | |
fi | |
# Find yaml files that have .metadata.namespace defined | |
for file in "${yaml_files[@]}"; do | |
if [ -f "$file" ]; then # Ensure the file still exists in the repository | |
NAMESPACE=$(yq e '.metadata.namespace // ""' "$file") | |
if [ "$NAMESPACE" != "$EXPECTED_NAMESPACE" ]; then | |
echo "::error file=$file::Error in file '$file': Namespace is '$NAMESPACE', expected '$EXPECTED_NAMESPACE'" | |
error_occurred=1 | |
else | |
echo "Namespace validation passed" | |
fi | |
else | |
echo "File $file has been deleted or is not accessible." | |
fi | |
done | |
# Exit with error if any validation failed | |
if [ $error_occurred -eq 1 ]; then | |
exit 1 | |
fi | |
shell: bash |