Skip to content

Commit

Permalink
fix to specify terraform version
Browse files Browse the repository at this point in the history
  • Loading branch information
maruloop committed Jun 3, 2024
1 parent f2a42e7 commit ddb45d9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 42 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,3 @@ jobs:
branch: depup/reviewdog
base: main
labels: "bump:minor"
terraform:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-depup@v1
id: depup
with:
file: Dockerfile
version_name: TERRAFORM_VERSION
repo: hashicorp/terraform
- name: Check if the latest version matches x.y.z
id: check_version
run: |
if [[ "${{ steps.depup.outputs.latest }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "match=true" >> "$GITHUB_OUTPUT"
else
echo "match=false" >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
if: steps.check_version.outputs.match == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore(deps): update terraform to ${{ steps.depup.outputs.latest }}"
commit-message: "chore(deps): update terraform to ${{ steps.depup.outputs.latest }}"
body: |
Update terraform to [v${{ steps.depup.outputs.latest }}](https://github.com/hashicorp/terraform/releases/tag/v${{ steps.depup.outputs.latest }})
Compare [v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }}](https://github.com/hashicorp/terraform/compare/v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }})
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3Adepup).
branch: depup/terraform
base: main
labels: "bump:minor"
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM alpine:3.20

ARG TERRAFORM_VERSION=1.7.3
ARG REVIEWDOG_VERSION=v0.17.4

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
Expand All @@ -9,10 +8,6 @@ RUN apk --no-cache add git jq

RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION}

RUN wget -q https://releases.hashicorp.com/terraform/"${TERRAFORM_VERSION}"/terraform_"${TERRAFORM_VERSION}"_linux_amd64.zip \
&& unzip ./terraform_"${TERRAFORM_VERSION}"_linux_amd64.zip -d /usr/local/bin/ \
&& rm -rf ./terraform_"${TERRAFORM_VERSION}"_linux_amd64.zip

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ inputs:
### Variables for terraform validate ###
terraform_version:
description: 'The terraform version to install and use.'
default: '1.7.3'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#!/bin/sh
set -e

TERRAFORM_VERSION=$1

if [ -n "${GITHUB_WORKSPACE}" ] ; then
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit 1
git config --global --add safe.directory "${GITHUB_WORKSPACE}" || exit 1
fi

wget -q https://releases.hashicorp.com/terraform/"${TERRAFORM_VERSION}"/terraform_"${TERRAFORM_VERSION}"_linux_amd64.zip \
&& unzip ./terraform_"${TERRAFORM_VERSION}"_linux_amd64.zip -d /usr/local/bin/ \
&& rm -rf ./terraform_"${TERRAFORM_VERSION}"_linux_amd64.zip

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

jq_script='
Expand Down

0 comments on commit ddb45d9

Please sign in to comment.