Skip to content

Commit

Permalink
action
Browse files Browse the repository at this point in the history
  • Loading branch information
danimtb committed Oct 4, 2023
1 parent 763cfb6 commit 0b43342
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/actions/prs_user_limit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'Limit PRs open per user'
description: 'Get all changed files in a Pull Request'
author: 'danimtb'
inputs:
files:
description: "Limit the number of open pull-request that user can have open at the same time"
required: false
default: ""
limit:
description: "Maximum number of PRs an author can open"
required: true
default: "10"
comment:
description: "Comment to post in the github PR when the limit of open PRs is reached"
required: true
default: "This is a comment"
runs:
using: "composite"
steps:
- uses: actions/github-script@v6
with:
script: |
const creator = context.payload.sender.login
const opts = github.rest.issues.listForRepo.endpoint.merge({
...context.issue,
creator,
is: 'pr'
state: 'open',
sort: 'created',
order: 'asc'
})
const prs = await github.paginate(opts)
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: Your number of PRs open is ${{ prs.length }} :wink:`
})
18 changes: 18 additions & 0 deletions .github/workflows/prs-user-limit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "[service] Alert Community"

on:
pull_request_target:
types: [opened]

env:
PYVER: "3.10"

jobs:
comment:
# if: github.repository == 'conan-io/conan-center-index'
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/prs_user_limit
with:
limit: 27
comment: "my comment"

0 comments on commit 0b43342

Please sign in to comment.