WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Added workflow to disallow large PRs #1

Added workflow to disallow large PRs

Added workflow to disallow large PRs #1

Workflow file for this run

name: "Detect large PRs"
permissions: read-all
on:
pull_request
jobs:
disallow-submodules:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
- name: Check PR size
run: |
response=$(curl --get -Ss -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${{ github.repository }}/pulls/${{github.event.pull_request.number}}")
additions=$(echo "$response" | jq -r '.additions')
deletions=$(echo "$response" | jq -r '.deletions')
echo "$additions lines added; $deletions lines deleted"
if (( $additions + $deletions > 500 )); then
echo "This PR changed more than 500 lines of code, which is too large. Your reviewer may ask you to break it into multiple PRs."
exit 1
else
echo "This PR changed 500 or fewer lines of code."
fi