-
Notifications
You must be signed in to change notification settings - Fork 30
43 lines (36 loc) · 1.61 KB
/
slack.yml
File metadata and controls
43 lines (36 loc) · 1.61 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
on:
# Run every Monday at 9:00 UTC (adjust as needed)
schedule:
- cron: "0 9 * * 1"
jobs:
send-reminder:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Retrieve open (non-draft) PRs
id: open_prs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
JSON=$(gh pr list --state open --json number,title,isDraft,url)
# Filter out draft pull requests
FILTERED=$(echo "$JSON" | jq '[.[] | select(.isDraft == false)]')
# Transform into Slack-friendly text:
# e.g. "• PR #123: My Pull Request Title (<URL>)"
MESSAGE=$(echo "$FILTERED" | jq -r '.[] | "• PR #\(.number): \(.title) (\(.url))\n"' )
# Join them into a single multiline string
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "message<<$EOF" >> $GITHUB_OUTPUT
echo "Hi <!subteam^S0611DEA7ED|@marketing-squad>, there are some open pull requests requiring review. Please work with the author to get them merged or closed:\n$MESSAGE" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Post to a Slack channel
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_TOKEN }}
payload: |
channel: C04N05LJK54
text: "${{ steps.open_prs.outputs.message }}"