-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create validate-namespace.yaml #41
Conversation
- name: Install yq | ||
uses: mikefarah/yq@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, steps are executed sequentially in GH actions, so this would probably go before the Validate namespace
step?
However, it's been a while since I've looked at actions so I might be wrong on this 😅
- name: Validate namespace | ||
id: validate-namespace | ||
run: | | ||
files_with_namespace=() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this required? I don't a see a reference to this anywhere else in the code.
Edit: Only referring to the files_with_namespace
variable here
changed_files=$(git diff --name-only HEAD^..HEAD) | ||
echo "Changed Files" | ||
echo "$changed_files" | ||
|
||
if [ -n "$changed_files" ]; then | ||
while IFS= read -r file; do | ||
if [[ "$file" =~ \.y(a)?ml$ ]]; then | ||
yaml_files+=("$file") | ||
fi | ||
done < <(echo "$changed_files") | ||
|
||
echo -e "\nFound yaml files:" | ||
for file in "${yaml_files[@]}"; do | ||
echo "$file" | ||
done | ||
else | ||
echo -e "\nNo YAML files were changed." | ||
exit 0 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally being a nitpick here, do you think it'd be helpful to collapse this into a single command -
yaml_files=($(git diff --name-only HEAD^..HEAD | grep -E '\.y(a)?ml$'))
The grep -E
would filter out .yaml
/ .yml
files.
If this was meant to provide more verbose outputs to the user then please feel free to disregard this suggestion.
No description provided.