Skip to content

Limit number of items in admin media pages #2327

Limit number of items in admin media pages

Limit number of items in admin media pages #2327

name: PR Limit Reminders
on:
pull_request_target:
types: [opened, reopened, ready_for_review]
jobs:
analyze-user-prs:
name: Count user's open pull requests
runs-on: ubuntu-latest
outputs:
pr_count: ${{ steps.count-prs.outputs.pr_count }}
slack_id: ${{ steps.count-prs.outputs.slack_id }}
should_alert: ${{ steps.count-prs.outputs.should_alert }}
steps:
- uses: actions/checkout@v4
- name: Count user PRs
uses: actions/github-script@v7
id: count-prs
env:
GH_SLACK_USERNAME_MAP: ${{ secrets.GH_SLACK_USERNAME_MAP }}
with:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
const script = require('./automations/js/src/count_user_reviewable_prs.js')
await script({github, context, core})
send_message:
needs: analyze-user-prs
name: Send Slack message
if: needs.analyze-user-prs.outputs.pr_count >= 5
runs-on: ubuntu-latest
env:
pr_count: ${{ needs.analyze-user-prs.outputs.pr_count }}
slack_id: ${{ needs.analyze-user-prs.outputs.slack_id }}
steps:
- name: Set required review count
run: |
echo "required_review_count=$(( pr_count * 1 ))" >> "$GITHUB_ENV"
- name: Send notification
id: slack
uses: slackapi/slack-github-action@v2
with:
webhook: ${{ secrets.SLACK_DM_WEBHOOK_URL }}
webhook-type: incoming-webhook
# Note: We cannot use the YAML folded chomping block syntax here (`>`) because
# GitHub Actions does not support it (they only support a subset of YAML):
# https://github.com/actions/runner/issues/418#issuecomment-612928525
payload: |
{
"user": "${{ env.slack_id }}",
"message": "Hi, Opener! \n You currently have ${{ env.pr_count }} Pull Request(s) open with requested reviews (totalling at least ${{ env.required_review_count }} required reviews). \n To help ease the review burden, increase review velocity for older PRs, and improve the equitable distribution of project maintenance tasks across the team, please consider reviewing this list of ways to contribute instead of working on new code contributions: \n https://docs.openverse.org/meta/maintainer_tasks.html"
}