From 80cce4b1d3dde3474319613613101ffa94c438d0 Mon Sep 17 00:00:00 2001 From: Stephen Attard Date: Wed, 15 Nov 2023 21:01:51 +0100 Subject: [PATCH] Linting and docs --- .github/workflows/test.yml | 9 ++++++++- README.md | 22 ++++++++++++++-------- action.yml | 3 +-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 347f59a..c987818 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,12 @@ on: push: jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: ibiqlik/action-yamllint@v3 + - uses: articulate/actions-markdownlint@v1 + test-terraform-version-file: runs-on: ubuntu-latest steps: @@ -31,8 +37,9 @@ jobs: - uses: actions/checkout@v4 - uses: ./ - name: run tfswitch with the version in an env var + env: + TF_VERSION: 1.6.2 run: | - export TF_VERSION=1.6.1 tfswitch 1.6.2 terraform --version diff --git a/README.md b/README.md index bd18e3d..329d10f 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,33 @@ # action-tfswitch -A github action to run tfswitch as a composite action +A github action to run [tfswitch](https://tfswitch.warrensbox.com/) as a [composite action](https://github.com/orgs/community/discussions/36861) ## Usage -To use tfswtich github action, configure a YAML workflow file, e.g. +To use tfswitch github action, configure a YAML workflow file, e.g. `.github/workflows/tfswitch.yml`, with the following: ```yaml -name: Run terraform +name: Install terraform via tfswitch + on: - pull_request + jobs: terraform: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - - name: Render terraform docs inside the README.md and push changes back to PR branch + - name: Setup tfswitch uses: stv-io/action-tfswitch@main - - name: Render terraform docs inside the README.md and push changes back to PR branch + - name: Install run: | - export TF_VERSION=1.6.1 - tfswitch 1.6.2 + tfswitch 1.6.4 terraform --version + terraform init + ... ``` + +## Credit + + diff --git a/action.yml b/action.yml index d9588c7..6d73a00 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: 'tfswitch' +name: tfswitch' description: 'Setup tfswitch to install a specific version of terraform' @@ -13,7 +13,6 @@ runs: exit 1 - name: Install tfswitch shell: bash - id: install run: | echo "Downloading install script .." curl -sLo install.sh https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh