I've been trying to capture the output of `sst dif...
# help
s
I've been trying to capture the output of
sst diff
into a variable within bash, but it appears the actual CDK diff is output via an inner child process or something. I end up getting something like this:
Copy code
❯ body=$(./node_modules/.bin/sst diff --stage dev)
Stack dev-foo
IAM Statement Changes
... actual CDK DIFF
And outputting body variable:
Copy code
❯ echo "$body"
Using stage: dev
Preparing your SST app
Building function src/foo/bar.handler
...
Anyone tried anything similar? I almost have a GitHub action working here. Just need to be able to nab the correct output. 😄
Granted all this would be far easier to go via SEED, unfortunately the client is all bought into GitHub workflow already.
d
you might be better off trying this in node instead of Bash
I have a very similar GitHub action, that runs Jest and outputs the coverage into a PR comment. The linked line is where I run the command and grab the output: https://github.com/dkershner6/jest-coverage-commenter-action/blob/58ed25dae88c7231f0d29779a58d976acbf02941/src/tasks/runJest.ts#L21
s
Tyvm