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

Migrate to setup-terraform-docs style action #89

Open
btkostner opened this issue Jul 18, 2022 · 4 comments
Open

Migrate to setup-terraform-docs style action #89

btkostner opened this issue Jul 18, 2022 · 4 comments

Comments

@btkostner
Copy link

btkostner commented Jul 18, 2022

What problem are you facing?

I am personally running into permission issues (#50), but I also see a lot of issues filed here about adding functionality to the git logic. These feature requests are just going to get more and more because this action tries to do too much.

How could terraform-docs help solve your problem?

This action should be renamed to terraform-docs/setup-action and instead of running a docker container, should install the binary file. This is similar to how setup-node, setup-go, and setup-terraform works. This allows the action to do very little, but be extremely powerful because it's composable with other actions in the workflow file.

@nikolaik
Copy link

YES to this!

@bodgit
Copy link

bodgit commented Feb 17, 2023

Instead of renaming the current action, just create a new one that DTRT.

I'd look at doing it myself but it will likely take someone more familiar with writing actions far less time than me blundering about.

@bodgit
Copy link

bodgit commented Feb 28, 2023

So, it turns out it's not too difficult, even for a JavaScript n00b like me!

An action is available here: bodgit/setup-terraform-docs

I started with a new repository using actions/javascript-action as a template and then used terraform-linters/setup-tflint and a few other similar actions as inspiration.

It's only slightly trickier logic as terraform-docs is released in a .zip archive on Windows and a .tar.gz on all other platforms so I need to handle that scenario.

The following works:

name: Docs
on:
  pull_request:

jobs:
  terraform-docs:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
        name: Checkout source code

      - uses: bodgit/setup-terraform-docs@main
        name: Setup Terraform Docs

      - name: Show location
        run: which terraform-docs

      - name: Show version
        run: terraform-docs --version

I need to test it on Windows to make sure it works there and replace the original generic action documentation. If anyone wants to kick the tyres on it try using main for now and I'll cut a v1 release soon.

@bodgit
Copy link

bodgit commented Mar 1, 2023

So I got to the point of publishing this to the marketplace and it flagged that there was an action that already existed. Sure enough there's https://github.com/lablabs/setup-terraform-docs which hadn't turned up when I tried looking for such an action.

It's deprecated in favour of the more generic https://github.com/jaxxstorm/action-install-gh-release so while this has been a fun voyage of discovery, I'm just going to use that action instead 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants