Slide 8
Slide 8 text
Code
#!/bin/bash
# Lintの結果をSlackに通知します
result_text=$(yarn lint 2>/dev/null | grep "✖") # ✖があるのは結果行
slack_payload="
[
{ … },
{
'type': 'section',
'text': {
'type': 'mrkdwn',
'text': '${result_text}'
}
},
{ … },
{ … },
]
"
curl 'https://slack.com/api/chat.postMessage' \
-X POST \
--header "Authorization: Bearer ${SLACK_ACCESS_TOKEN}" \
-d "channel=${SLACK_DEFAULT_CHANNEL}" \
-d "text=${result_text}" \
-d "blocks=${slack_payload}"
- run:
name: Send Lint Results
command: sh .circleci/send_lint_result.sh;
nightry:
triggers:
- schedule:
cron: "0 15 * * *" # UTC
filters:
branches:
only:
- develop
jobs:
- lint
jobをスケジュールして
checkoutや依存関係のインストール後にshellを実行するようにして
実行結果 を取得してSlackAPIを叩くだけ
@tachibanayu24