Skip to content

Commit

Permalink
add Send Notification to Chatwork
Browse files Browse the repository at this point in the history
  • Loading branch information
hanayo04 committed Oct 25, 2024
1 parent 8a9db37 commit e1e5a17
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/notification.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Send Notification to Chatwork

on:
pull_request:
types: [opened]

jobs:
notify:
runs-on: ubuntu-latest

steps:
- name: Send notification to Chatwork
env:
CHATWORK_API_TOKEN: ${{ secrets.CHATWORK_API_TOKEN_GITHUB }}
CHATWORK_ROOM_ID: ${{ secrets.CHATWORK_ROOM_ID }}
run: |
PR_TITLE=$(jq -r '.pull_request.title' $GITHUB_EVENT_PATH)
PR_URL=$(jq -r '.pull_request.html_url' $GITHUB_EVENT_PATH)
PR_USER=$(jq -r '.pull_request.user.login' $GITHUB_EVENT_PATH)
BODY=`cat <<EOS
PR_URL : ${PR_URL}
user : ${PR_USER}
EOS`
MESSAGE="[info][title]${PR_TITLE}[/title]${BODY}[/info]"
curl -sS -X POST -H "X-ChatWorkToken: $CHATWORK_API_TOKEN" \
--data-urlencode "body=${MESSAGE}" \
"https://api.chatwork.com/v2/rooms/$CHATWORK_ROOM_ID/messages"

0 comments on commit e1e5a17

Please sign in to comment.