-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (31 loc) · 1.19 KB
/
readme-update-to-slack.yml
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
name: Notify on README.md update
on:
push:
paths:
- 'README.md'
jobs:
notify_on_readme_update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get commit author
id: commit_author
run: echo "author=$(git log -1 --pretty=format:'%an')" >> $GITHUB_OUTPUT
- name: Get last commit
id: last_commit
run: echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Generate commit comparison URL
id: commit_comparison_url
run: |
repo_name="${{ github.repository }}"
last_commit="${{ steps.last_commit.outputs.commit_sha }}"
echo "https://github.com/${repo_name}/commit/${last_commit}"
echo "comparison_url=https://github.com/${repo_name}/commit/${last_commit}" >> $GITHUB_OUTPUT
- name: Send Slack notification
run: |
curl -X POST -H 'Content-type: application/json' --data '{
"Message": "${{ steps.commit_comparison_url.outputs.comparison_url }}",
"Assignee": "U05GG8NJF7U",
"Origin_Repo": "'"${{ github.repository }}"'"
}' "${{ secrets.SLACK_WEBHOOK_URL }}"