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

fix: use terraform.tf files as fallback cache #68

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lint/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ runs:
run: |
echo "TF_PLUGIN_CACHE_DIR=${{ runner.temp }}/.terraform.d/plugin-cache" >>"$GITHUB_ENV"
mkdir --parents "${{ runner.temp }}/.terraform.d/plugin-cache"
- name: Check for terraform lockfiles
id: check_terraform_lockfiles
tagoro9 marked this conversation as resolved.
Show resolved Hide resolved
if: inputs.s3-bucket-name != ''
uses: andstor/file-existence-action@v3
with:
files: "**/.terraform.lock.hcl"
- name: Compute terraform plugin cache key
if: inputs.s3-bucket-name != ''
id: tf_plugin_cache_key
run: |
echo "key=terraform-${{ runner.os }}-${{ hashFiles('**/.terraform.lock.hcl') }}" >> $GITHUB_OUTPUT
echo "key=terraform-${{ runner.os }}-${{ steps.check_terraform_lockfiles.outputs.files_exists == 'true' && hashFiles('**/.terraform.lock.hcl') || hashFiles('**/terraform.tf') }}" >> $GITHUB_OUTPUT
shell: bash
- name: Load cached terraform plugins if available
if: inputs.s3-bucket-name != ''
Expand Down
8 changes: 7 additions & 1 deletion test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ runs:
run: |
echo "TF_PLUGIN_CACHE_DIR=${{ runner.temp }}/.terraform.d/plugin-cache" >>"$GITHUB_ENV"
mkdir --parents "${{ runner.temp }}.terraform.d/plugin-cache"
- name: Check for terraform lockfiles
id: check_terraform_lockfiles
if: inputs.s3-bucket-name != ''
uses: andstor/file-existence-action@v3
with:
files: "**/.terraform.lock.hcl"
- name: Compute terraform plugin cache key
if: inputs.s3-bucket-name != ''
id: tf_plugin_cache_key
run: |
echo "key=terraform-${{ runner.os }}-${{ hashFiles('**/.terraform.lock.hcl') }}" >> $GITHUB_OUTPUT
echo "key=terraform-${{ runner.os }}-${{ steps.check_terraform_lockfiles.outputs.files_exists == 'true' && hashFiles('**/.terraform.lock.hcl') || hashFiles('**/terraform.tf', '**/versions.tf') }}" >> $GITHUB_OUTPUT
shell: bash
- name: Load cached terraform plugins if available
if: inputs.s3-bucket-name != ''
Expand Down
Loading