* Fix output malformed when wrapper enabled
Presently using a command such as `terraform output -json | jq` does not
work with the wrapper enabled, as it is by default.
In order to consume terraform's output having set it up with this
Action, it is necessary either to disable the wrapper (`with:
terraform_wrapper: false`) or run it in its own Actions step with an
explicit `id` (e.g. `id: foo`) so that it can be referred to and consumed
(`${{steps.foo.outputs.stdout}}` et al.) in later steps.
This seems to be the result of much confusion (issues passim) and is not
at all easy (#338) to debug/diagnose and come to the realisation that
it's due to the wrapper, or even that such a thing exists.
@austinvalle identified the issue as being due to the `@actions/exec`
package writing the spawned command to stdout (along with then its
actual stdout). This has previously been reported upstream in
actions/toolkit#649; I've proposed actions/toolkit#1573 to fix it.
This commit aims to address the issue for `setup-terraform` in the
meantime by silencing `@actions/exec` and then writing out to stdout &
stderr from the listener buffers, which it writes to without this
additional logging.
Closes#20, #80, #85, #149, #338, and probably more.
* add test for stdout with jq
* update test name
* remove debug lines and add changelog
* add additional note about the bug fix to wrapper
---------
Co-authored-by: Austin Valle <austinvalle@gmail.com>
Reference: https://github.com/hashicorp/ghaction-terraform-provider-release/issues/44
```console
$ gh release create --help
Create a new GitHub Release for a repository.
A list of asset files may be given to upload to the new release. To define a
display label for an asset, append text starting with `#` after the file name.
If a matching git tag does not yet exist, one will automatically get created
from the latest state of the default branch.
Use `--target` to point to a different branch or commit for the automatic tag creation.
Use `--verify-tag` to abort the release if the tag doesn't already exist.
To fetch the new tag locally after the release, do `git fetch --tags origin`.
To create a release from an annotated git tag, first create one locally with
git, push the tag to GitHub, then run this command.
When using automatically generated release notes, a release title will also be automatically
generated unless a title was explicitly passed. Additional release notes can be prepended to
automatically generated notes by using the notes parameter.
USAGE
gh release create [<tag>] [<files>...]
FLAGS
--discussion-category string Start a discussion in the specified category
-d, --draft Save the release as a draft instead of publishing it
--generate-notes Automatically generate title and notes for the release
--latest Mark this release as "Latest" (default: automatic based on date and version)
-n, --notes string Release notes
-F, --notes-file file Read release notes from file (use "-" to read from standard input)
--notes-start-tag string Tag to use as the starting point for generating release notes
-p, --prerelease Mark the release as a prerelease
--target branch Target branch or full commit SHA (default: main branch)
-t, --title string Release title
--verify-tag Abort in case the git tag doesn't already exist in the remote repository
```
Reference: https://github.com/hashicorp/setup-terraform/issues/290
The `wrapper` directory contains the JavaScript wrapper for the Terraform binary. It currently contains a `package.json` and lock file, however this code is not packaged and released separately. Having the separate package makes it unnecessarily difficult to ensure the subdirectory is built correctly and dependencies are up to date.
This change removes the `wrapper` package files and consolidates the test, lint, and build logic into the main `package.json`.