action-slack/.github/workflows/slack-pre.yml

106 строки
3.4 KiB
YAML

name: Slack Pre
on:
push:
branches:
- pre
jobs:
notification:
runs-on: ubuntu-latest
steps:
- name: Succeeded
uses: 8398a7/action-slack@pre
with:
status: Success
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_INTEGRATION_TEST }}
- name: Failed
uses: 8398a7/action-slack@pre
with:
status: Failure
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_INTEGRATION_TEST }}
- name: Canceled
uses: 8398a7/action-slack@pre
with:
status: Cancelled
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_INTEGRATION_TEST }}
- name: Legacy Webhook URL
uses: 8398a7/action-slack@pre
with:
status: ${{ job.status }}
username: legacy user
icon_emoji: ":octocat:"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_LEGACY_WEBHOOK_URL_FOR_INTEGRATION_TEST }}
- name: Custom Field
uses: 8398a7/action-slack@pre
with:
status: custom
custom_payload: |
{
text: "Custom Field Check",
attachments: [{
"author_name": "8398a7@action-slack", // json
fallback: 'fallback',
color: 'good',
title: 'CI Result',
text: 'Succeeded',
fields: [{
title: 'lower case',
value: 'LOWER CASE CHECK'.toLowerCase(),
short: true
},
{
title: 'reverse',
value: 'gnirts esrever'.split('').reverse().join(''),
short: true
},
{
title: 'long title1',
value: 'long value1',
short: false
}],
actions: [{
}]
}]
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_INTEGRATION_TEST }}
- name: No GITHUB_TOKEN
uses: 8398a7/action-slack@pre
with:
status: ${{ job.status }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_INTEGRATION_TEST }}
- name: if_mention
uses: 8398a7/action-slack@pre
with:
status: ${{ job.status }}
mention: here
if_mention: always
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_INTEGRATION_TEST }}
- name: Fields Check
uses: 8398a7/action-slack@pre
with:
status: ${{ job.status }}
fields: repo,message,commit,author,job,eventName,ref,workflow,took
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FOR_INTEGRATION_TEST }}
- uses: 8398a7/action-slack@pre
with:
status: ${{ job.status }}
fields: repo,message,job,took
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}