Fields

caution: Additional configuration is required to work with matrix.

Don't forget to add MATRIX_CONTEXT. Not required if the fields do not contain jobs or tooks.

steps:
- uses: 8398a7/action-slack@v3
with:
fields: job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required

If you have more than one, please enter it in csv format. Corresponding types are as follows.

success
FieldEnvironment VariableDescription
repoAS_REPOA working repository name
commitAS_COMMITcommit hash
eventNameAS_EVENT_NAMEtrigger event name
refAS_REFgit reference
workflowAS_WORKFLOWGenerate a workflow link from git sha
messageAS_MESSAGEcommit message
authorAS_AUTHORThe author who pushed
jobAS_JOBGenerate a job run link of the job that was executed
tookAS_TOOKExecution time for the job
pullRequestAS_PULL_REQUESTPull Request title, number with link
steps:
- uses: 8398a7/action-slack@v3
with:
fields: repo,commit
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required

If you want all items, specify all.

steps:
- uses: 8398a7/action-slack@v3
with:
fields: all
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required

In either of the following cases, You must use the job_name parameter instead of the MATRIX_CONTEXT.

  1. Overwrite job name by name syntax
  2. Using matrix with include

Because when constructing the job name in the action-slack, the key specified by include is included in the matrix map. It does not match the actual job name.

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-18.04]
node: [8, 10, 12, 14]
include:
- os: windows-latest
node: 8
npm: 6
steps:
- uses: 8398a7/action-slack@v3
with:
job_name: test (${{ matrix.os }}, ${{ matrix.node }}) # named without `npm`
fields: job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required