-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathauthor.yml
More file actions
56 lines (52 loc) · 1.88 KB
/
author.yml
File metadata and controls
56 lines (52 loc) · 1.88 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Direct message the author
on:
push:
jobs:
run:
name: Send a notification of recent changes
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Find correspondences
id: email
uses: slackapi/slack-github-action@v3.0.0
with:
method: users.lookupByEmail # https://docs.slack.dev/reference/methods/users.lookupByEmail/
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
email: ${{ github.event.pusher.email }}
- name: Search email detail
if: ${{ steps.email.outputs.ok }}
run: |
SLACK_USER_ID=$(echo '${{ steps.email.outputs.response }}' | jq -r '.user.id')
echo "SLACK_USER_ID=$SLACK_USER_ID" >> $GITHUB_ENV
- name: Send a direct message
if: ${{ steps.email.outputs.ok }}
uses: slackapi/slack-github-action@v3.0.0
with:
errors: true
method: chat.postMessage # https://docs.slack.dev/reference/methods/chat.postMessage/
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
"channel": "${{ env.SLACK_USER_ID }}",
"text": "${{ github.repository }} had a change!",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":large_green_square: <https://github.com/${{ github.repository }}|*${{ github.repository }}*>: `${{ github.sha }}`"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(github.event.head_commit.message) }}
}
}
]