Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

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

Open
grebois opened this issue Nov 3, 2020 · 0 comments
Open

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

grebois opened this issue Nov 3, 2020 · 0 comments

Comments

@grebois
Copy link
Contributor

grebois commented Nov 3, 2020

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/[email protected]
        continue-on-error: false
        with:
          command: kustomize build . 

      - uses: actions/[email protected]
        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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant