summaryrefslogtreecommitdiff
path: root/.github/actions/slack/action.yml
blob: c98be085a88656dcf3dab227d0e16f9eadd17f97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Post a message to slack
description: >-
  We have our ruby/action-slack webhook.  However its arguments are
  bit verbose to be listed in every workflow files.  Better merge them
  into one.

inputs:
  SLACK_WEBHOOK_URL:
    required: true
    description: >-
      The URL to post the payload.  This is an input because it tends
      to be stored in a secrets valut and a composite action cannot
      look into one.

  label:
    required: false
    description: >-
      Human-readable description of the run, something like "DEBUG=1".
      This need not be unique among runs.

outputs: {} # Nothing?

runs:
  using: composite

  steps:
    - uses: ruby/action-slack@0bd85c72233cdbb6a0fe01d37aaeff1d21b5fce1 # v3.2.1
      with:
        payload: |
          {
            "ci": "GitHub Actions",
            "env": "${{ github.workflow }}${{ inputs.label && format(' / {0}', inputs.label) }}",
            "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
            "commit": "${{ github.sha }}",
            "branch": "${{ github.ref_name }}"
          }
      env:
        SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }}
      if: ${{github.event_name == 'push' && startsWith(github.repository, 'ruby/')}}