This workflow checks to ensure that terraform-docs has been ran in a specified directory. The aim is to check any changes made to the tofu/ directory have been captured e.g. new resources, data sources, modules etc. This then helps consumers/developers understand quickly how the module itself behaves.
This Action was custom made by me, although there is an official GitHub Action available. Upon using it, I noticed the config file when passed in is completely ignored. Unfortunately it seems to be a bug as others have reported it as well: https://github.com/terraform-docs/gh-actions/issues/136.
Here we download the binary passed in via the calling workflow input, which at the time of writing is v0.19.0 which is passed to the URL which uses curl to then download it, extract it using tar, make it executable and then move it into a directory that is in $PATH.
Note
I could use the $GITHUB_PATH environment variable to append a new directory to the $PATH, but my own Linux experience is to move user owned binaries into the /usr/local/bin directory.
We then confirm the version as part of the workflow, pass in the config file and then use the --output-check flag which returns which locations haven't been updated based on the latest OpenTofu configuration.