Skip to content
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

Merged
merged 1 commit into from
May 15, 2024
Merged

Create validate-namespace.yaml #41

merged 1 commit into from
May 15, 2024

Conversation

tcaky
Copy link
Collaborator

@tcaky tcaky commented May 15, 2024

No description provided.

@tcaky tcaky requested a review from vedantthapa May 15, 2024 14:47
@tcaky tcaky requested a review from ericmalen May 15, 2024 15:03
@tcaky tcaky requested a review from ericmalen May 15, 2024 15:15
@ericmalen ericmalen merged commit 5a9841b into main May 15, 2024
1 check passed
Comment on lines +67 to +68
- name: Install yq
uses: mikefarah/yq@v4
Copy link
Collaborator

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=()
Copy link
Collaborator

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

Comment on lines +26 to +44
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
Copy link
Collaborator

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.

@tcaky tcaky deleted the tcaky-patch-2 branch May 16, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants