forked from 2i2c-org/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.69 KB
/
approved_prs_reminder.yaml
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
name: Ping slack if we have approved PRs waiting to merge
on:
schedule:
# Run every MWF at 07:00 AM UTC / 09:00AM Europe / 00:00AM California
- cron: "0 07 * * 1,3,5"
workflow_dispatch:
inputs:
message:
description: "Message to send to Slack"
required: true
default: "Here's a test message!"
jobs:
create-sync-issue:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
- name: Install python
run: pip install ghapi pandas
- name: Pull open PRs and check if they have old approvals
id: approved-prs
run: python extra_scripts/approved_prs_reminder.py
# Decide what message to send
- name: Sets env vars for automated message
if: github.event_name != 'workflow_dispatch'
run: |
echo "SLACK_MESSAGE=${{ steps.approved-prs.outputs.PRS_MESSAGE }}" >> $GITHUB_ENV
echo "DO_SEND_MESSAGE=${{ steps.approved-prs.outputs.DO_SEND_MESSAGE }}" >> $GITHUB_ENV
- name: Sets env vars for dispatch message
if: github.event_name == 'workflow_dispatch'
run: |
echo "SLACK_MESSAGE=${{ github.event.inputs.message }}" >> $GITHUB_ENV
echo "DO_SEND_MESSAGE=TRUE" >> $GITHUB_ENV
# Ref: https://github.com/slackapi/slack-github-action#technique-2-slack-app
- name: Post to a Slack channel
if: ${{ env.DO_SEND_MESSAGE == 'TRUE' }}
id: slack
uses: slackapi/[email protected]
with:
channel-id: "C0206KLF76E" # This is hub-development
slack-message: ${{ env.SLACK_MESSAGE }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}