Skip to content

Commit

Permalink
fix: try with env
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-calabrese committed Feb 3, 2025
1 parent fd7e88c commit fdb32a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .github/actions/get-pre-commit-version/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ inputs:
outputs:
pre_commit_terraform_version:
description: "The pre-commit-terraform version retrieved or the default."
value: ${{ steps.get-version.outputs.pre_commit_terraform_version }}
runs:
using: "composite"
steps:
- name: Get Pre-Commit Terraform Version
id: get-version
shell: bash
run: |
# Default version from input
Expand Down Expand Up @@ -39,5 +41,10 @@ runs:
fi
fi
# Output the pre-commit Terraform version
echo "pre_commit_terraform_version=$PRE_COMMIT_VERSION" >> $GITHUB_OUTPUT
# Save to GITHUB_ENV first (correct for composite actions)
echo "pre_commit_terraform_version=$PRE_COMMIT_VERSION" >> "$GITHUB_ENV"
- name: Set Output
id: set-output
shell: bash
run: echo "pre_commit_terraform_version=${{ env.pre_commit_terraform_version }}" >> "$GITHUB_OUTPUT"
10 changes: 8 additions & 2 deletions .github/actions/get-terraform-version/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ inputs:
outputs:
terraform_version:
description: "The Terraform version retrieved or the default."
value: ${{ steps.get-version.outputs.terraform_version }}
runs:
using: "composite"
steps:
- name: Get Terraform Version
id: get-version # Needed to expose outputs in composite actions!
shell: bash
run: |
# Default version provided via input
Expand All @@ -34,5 +36,9 @@ runs:
echo "No .terraform-version file found. Defaulting to ${TERRAFORM_VERSION}"
fi
# Output the Terraform version
echo "terraform_version=$TERRAFORM_VERSION" >> $GITHUB_OUTPUT
# Correct way to set outputs in composite actions
echo "terraform_version=$TERRAFORM_VERSION" >> "$GITHUB_ENV"
- name: Set Output
id: set-output
shell: bash
run: echo "terraform_version=${{ env.terraform_version }}" >> "$GITHUB_OUTPUT"

0 comments on commit fdb32a8

Please sign in to comment.