Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how get error from test step to send it in slack? #62

Open
kamil-nawrotkiewicz opened this issue Mar 24, 2023 · 0 comments
Open

how get error from test step to send it in slack? #62

kamil-nawrotkiewicz opened this issue Mar 24, 2023 · 0 comments

Comments

@kamil-nawrotkiewicz
Copy link

Each of echo error return null or empty string. How get error output from apiTestInstance?

  api-test-instance:
    runs-on: self-hosted
    steps:
      - uses: rlespinasse/github-slug-action@v4
        with:
          short-length: 5
      - uses: actions/checkout@master
      - name: Test api postman
        id: apiTestInstance
        uses: matt-ball/newman-action@master
        with:
          apiKey: ${{ secrets.POSTMAN_API_KEY }}
          collection: "postman/collections/collection.json"
          environment: "xxx"
      - name: Echo Error
        if: failure()
        run: |
          echo "apiTestInstance failed with the following error message:"
          echo "${{ steps.apiTestInstance.log }}"
      - name: Echo Error 2
        if: failure()
        run: |
          echo "apiTestInstance failed with the following error message:"
          echo "${{ steps.apiTestInstance.outputs['newman-error'] }}"
      - name: Echo Error 3
        if: failure()
        run: |
          echo "apiTestInstance failed with the following error message:"
          echo "${{ steps.apiTestInstance.outputs.stdout }}"
      - name: Echo Error 4
        if: failure()
        run: |
          echo "apiTestInstance failed with the following error message:"
          echo "${{ steps.apiTestInstance.outputs.newman-error }}"
      - name: Echo Error 5
        if: failure()
        run: |
          echo "apiTestInstance failed with the following error message:"
          echo "${{ steps.apiTestInstance.outputs }}"
      - name: Echo Error 6
        if: failure()
        run: |
          echo "apiTestInstance failed with the following error message:"
          echo "${{ toJson(steps.apiTestInstance.outputs) }}"
      - name: Send Slack Message
        if: failure()
        uses: slackapi/[email protected]
        with:
          payload: |
            {
              "text": "Errors from tests api postman",
              "blocks": [
                {
                  "type": "section",
                  "text": {
                    "type": "mrkdwn",
                    "text": "Newman test failed: ${{ steps.apiTestInstance.outputs['newman-error'] }}"
                  }
                }
              ]
            }
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_POSTMAN_NOTIFICATION_URL }}
          SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant