stefanprodan / kube-tools

Kubernetes tools for GitHub Actions CI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How to get the output for usage in another step?

grebois opened this issue · comments

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:

https://github.com/hashicorp/learn-terraform-github-actions/blob/master/.github/workflows/terraform.yml

https://www.civo.com/learn/use-the-terraform-provider-of-civo-in-github-actions-and-s3-to-save-the-state#the-action

https://github.com/ManagedKube/kubernetes-ops/blob/master/.github/workflows/terraform-eks-pipeline.yaml

hashicorp/setup-terraform#7 (comment)

https://github.com/marketplace/actions/terraform-pr-commenter

@stefanprodan would you might be able to help me out?