-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (32 loc) · 1.42 KB
/
notify-guests.yml
File metadata and controls
34 lines (32 loc) · 1.42 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
name: Notify User
on:
issues:
types: [opened]
jobs:
notify-user:
runs-on: ubuntu-latest
steps:
- name: Check if stream date is not yet scheduled
id: check-date
env:
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
echo "::set-output name=not_yet::$(echo '$ISSUE_BODY' | grep -q 'Not yet' && echo 'true' || echo 'false')"
- name: Comment on issue
if: steps.check-date.outputs.not_yet == 'true'
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issueBody = context.payload.issue.body;
const githubHandleMatch = issueBody.match(/@[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}/gi);
if (githubHandleMatch && githubHandleMatch.length > 0) {
const githubHandle = githubHandleMatch[0].substring(1); // Remove the '@' from the handle
const issueComment = {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `Hey @${githubHandle}✨,\n\nThank you for your interest in Open Source Friday! Please remember to book a date and time for the stream at the following link: https://calendar.app.google/7fdFRJ7G1jeAM5Vy8 \n\nTalk soon,\nKedasha and Andrea`
};
github.rest.issues.createComment(issueComment);
}