Question: How to get the output for usage in another step?
grebois opened this issue · comments
Marcelo Grebois commented
So from according to my research this is done by creating and env and then just quote it and post it, like this:
name: CI
on: [pull_request]
jobs:
kustomize:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: kustomize
id: kustomize
uses: stefanprodan/kube-tools@v1.5.0
continue-on-error: false
with:
command: kustomize build .
- uses: actions/github-script@0.9.0
if: github.event_name == 'pull_request'
env:
kustomize: "${{ steps.kustomize.outputs.stdout }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Kustomize build ::: \`${{ steps.kustomize.outcome }}\`
<details><summary>Show Plan</summary>
\`\`\`${process.env.kustomize}\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
I mean, it looks pretty straight forward, but steps.kustomize.outputs.stdout
and process.env.kustomize
are always empty, maybe its something really stupid that i'm missing, here are some example that work just fine:
hashicorp/setup-terraform#7 (comment)
https://github.com/marketplace/actions/terraform-pr-commenter
@stefanprodan would you might be able to help me out?