chore: pr reminder for slack (#21830)

Co-authored-by: auricom <27022259+auricom@users.noreply.github.com>
This commit is contained in:
Marko 2024-09-25 14:50:45 +02:00 committed by GitHub
parent d54f6fa95b
commit e52d3b16e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

52
.github/workflows/pr-reminder.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: PR Review Reminder
on:
schedule:
- cron: '0 9 * * 1-5' # Every weekday at 9:00 AM UTC
permissions:
pull-requests: read
jobs:
pr-review:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: List open pull requests using GitHub Script
uses: actions/github-script@v7
id: pr-list
with:
script: |
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
let table = '';
pullRequests.forEach(pr => {
const assignees = pr.assignees.length > 0 ? `Assignees: ${pr.assignees.map(assignee => assignee.login).join(', ')}` : 'No assignees';
table += pr.draft ? '' : `
Title: ${pr.title}
Link: <${pr.html_url}>
Assigness: ${assignees}
`;
});
return table;
- name: Send Slack Reminder
if: steps.pr-list.outputs.result != ''
uses: rtCamp/action-slack-notify@v2.3.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: pr-github
SLACK_USERNAME: PR-Reminder
MSG_MINIMAL: true
SLACK_ICON_EMOJI: ":think:"
SLACK_COLOR: good
SLACKIFY_MARKDOWN: true
SLACK_TITLE: Daily Pull Request Review Reminder
SLACK_MESSAGE: |
${{ steps.pr-list.outputs.result }}