Skip to content

Commit

Permalink
Fix linting version check
Browse files Browse the repository at this point in the history
  • Loading branch information
juliocc committed Jan 9, 2025
1 parent aeed8a3 commit 25b4590
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Google LLC
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -105,18 +105,17 @@ jobs:
- name: Check modules versions
id: versions
run: |
OUTPUT_TF=$(find . -type f -name 'versions.tf' -exec diff -ub default-versions.tf {} \;)
OUTPUT_TF=$(find . -type f -name 'versions.tf' -exec diff -ub default-versions.tf {} \; | grep -v '^[+-][[:space:]]*module_name')
if [[ -n "${OUTPUT_TF}" ]] ; then
echo "Terraform versions.tf:"
echo "${OUTPUT_TF}"
fi
OUTPUT_TOFU=$(find . -type f -name 'versions.tofu' -exec diff -ub default-versions.tofu {} \;)
OUTPUT_TOFU=$(find . -type f -name 'versions.tofu' -exec diff -ub default-versions.tofu {} \; | grep -v '^[+-][[:space:]]*module_name')
if [[ -n "${OUTPUT_TOFU}" ]] ; then
echo "Terraform versions.tofu:"
echo "${OUTPUT_TOFU}"
fi
grep -v required_version default-versions.tf > /tmp/versions.tf
grep -v required_version default-versions.tofu > /tmp/versions.tofu
diff -rub /tmp/versions.tf /tmp/versions.tofu
egrep -v (required_version|module_name) default-versions.tf > /tmp/versions.tf
egrep -v (required_version|module_name) default-versions.tofu > /tmp/versions.tofu
DIFF_EC=$?
[[ "${DIFF_EC}" -eq "0" || -z "${OUTPUT_TF}" || -z "${OUTPUT_TOFU}" ]]

0 comments on commit 25b4590

Please sign in to comment.