forcedotcom / salesforcedx-actions

(Unofficial) GitHub Actions for SalesforceDX using the Salesforce CLI
BSD 3-Clause "New" or "Revised" License
38 stars 32 forks source link

Can not see commands output #3

Open dieffrei opened 4 years ago

dieffrei commented 4 years ago

This is my yml file:


on: [push]

jobs:

  commit-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: 'Populate auth file with SFDX_URL secret'
        shell: bash
        run: 'echo ${{ secrets.DEV_HUB_SFDXURL}} > ./SFDX_URL_STORE.txt'
      - name: 'Display dir'
        shell: bash
        run: 'ls'
      - name: 'Authenticate against dev hub'
        uses: forcedotcom/salesforcedx-actions@master
        with:
          args: 'force:auth:sfdxurl:store --sfdxurlfile=./SFDX_URL_STORE.txt --setalias=devhub --setdefaultdevhubusername'
      - name: 'Create scratch org'
        uses: forcedotcom/salesforcedx-actions@master
        with:
          args: 'force:org:create --definitionfile=config/project-scratch-def.json --setalias=scratch-org --setdefaultusername'
      - name: 'Push source'
        uses: forcedotcom/salesforcedx-actions@master
        with:
          args: 'force:source:push -f'
      - name: 'Run unit tests'
        uses: forcedotcom/salesforcedx-actions@master
        with:
          args: 'force:apex:test:run -l RunLocalTests -w 30'
      - name: 'Delete scratch org'
        uses: forcedotcom/salesforcedx-actions@master
        with:
          args: 'force:org:delete --targetusername=scratch-org --noprompt'

When a command fails like SFDX force:push I can not see the output error. Are there any option which I can see the output of commands?

cuporter commented 4 years ago

You can see the output if you give the step an id and then echo the result from that step:

     - name: 'Show devhub limits'
        id: devhublimits
        uses: forcedotcom/salesforcedx-actions@master
        with:
          args: 'force:limits:api:display -u ${{ secrets.SALESFORCE_DEVHUB_USERNAME }}'
      - name: 'Show devhub limits output'
        run: |
          result="${{ steps.devhublimits.outputs.result }}"
          echo "$result"

Something I haven't figured out is how to make it print the newlines instead of squashing everything into one line. In a normal sh you can do this with double quotes around the variable:

$ result=$(sh -c ls)
$ echo "$result"
config
force-app
README.md
scripts
sfdx-project.json

Unfortunately this isn't working with salesforcedx-actions.