Skip to content

Fields

steps:
- uses: h3y6e/action-slack@v4
with:
status: ${{ job.status }}
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
workflowRunAS_WORKFLOW_RUNGenerate a link to the present workflow run
messageAS_MESSAGEcommit message
authorAS_AUTHORThe author who pushed
actionAS_ACTIONGenerate a checks page link from git sha
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: h3y6e/action-slack@v4
with:
status: ${{ job.status }}
fields: repo,commit
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required

If you want all items, specify all.

steps:
- uses: h3y6e/action-slack@v4
with:
status: ${{ job.status }}
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-latest]
node: [18, 20, 22, 24]
include:
- os: windows-latest
node: 8
npm: 6
steps:
- uses: h3y6e/action-slack@v4
with:
status: ${{ job.status }}
job_name: test (${{ matrix.os }}, ${{ matrix.node }}) # named without `npm`
fields: job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required