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

If you are using matrix.include, you will get "Job is not found" #137

Closed
KoheiKanagu opened this issue May 6, 2021 · 1 comment
Closed

Comments

@KoheiKanagu
Copy link

If you use matrix.include, as in the following sample, you will get errors in job and tok.

スクリーンショット 2021-05-06 18 21 39

name: Releases
on:
  push:
    branches:
      - master
jobs:
  deploy:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        flavor: [dev, stg, prod]
        include:
          - os: ubuntu-latest
            text: "hello ubuntu"
          - os: macos-latest
            text: "hello macos"

    runs-on: ${{ matrix.os }}
    steps:
      - name: action-slack
        uses: 8398a7/action-slack@v3
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
          MATRIX_CONTEXT: ${{ toJson(matrix) }}
        with:
          fields: repo,commit,job,took,workflow
          status: ${{ job.status }}
          text: "${{ toJson(matrix) }}"

In this case, the value of matrix is as follows.

{
 "os": "macos-latest",
 "flavor": "prod",
 "text": "hello macos"
}

So, the jobName will be something like deploy (macos-latest, prod, hello macos), and the currentJob will be undefined.
https://github.com/8398a7/action-slack/blob/v3/src/client.ts#L77-L78
https://github.com/8398a7/action-slack/blob/v3/src/fields.ts#L141-L145

If I did not include the matrix.include value in MATRIX_CONTEXT, the job and took worked.

MATRIX_CONTEXT: '{"os": "${{ matrix.os }}", "flavor": "${{ matrix.flavor }}" }'
@8398a7
Copy link
Owner

8398a7 commented Jul 23, 2021

If name is changed when using matrix, it will not work.
This specification will be described in the documentation.

I have also created an issue for it to work.
If there is further discussion, please do so here.
refs: #150

@8398a7 8398a7 closed this as completed Jul 23, 2021
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

2 participants