Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr policy rules #146

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/content-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,44 @@ jobs:

- name: Install dependencies
run: npm install

- name: Check for existing open PRs
id: check-prs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
contributor_login=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
pr_branch=$(jq -r '.pull_request.head.ref' "$GITHUB_EVENT_PATH")

# Fetch open PRs from the repository
open_prs=$(gh pr list --repo $GITHUB_REPOSITORY --state open --json author,headRefName)
echo "All open PRs: $open_prs"

# Filter PRs by author and convert to array
contributor_prs=$(echo "$open_prs" | jq --arg login "$contributor_login" '[.[] | select(.author.login == $login)]')
echo "Filtered PRs: $contributor_prs"

pr_count=$(echo "$contributor_prs" | jq 'length')
echo "PR count: $pr_count"

if [ "$pr_count" -gt 1 ]; then
echo "has_open_prs=true" >> "$GITHUB_OUTPUT"
elif [ "$pr_count" -eq 1 ]; then
existing_branch=$(echo "$contributor_prs" | jq -r '.[0].headRefName')
if [ "$existing_branch" != "$pr_branch" ]; then
echo "has_open_prs=true" >> "$GITHUB_OUTPUT"
else
echo "has_open_prs=false" >> "$GITHUB_OUTPUT"
fi
else
echo "has_open_prs=false" >> "$GITHUB_OUTPUT"
fi

- name: Fail if multiple PRs
if: steps.check-prs.outputs.has_open_prs == 'true'
run: |
echo "::error::Our policy allows only one active PR per contributor. Please complete existing work before submitting new changes."
exit 1

- name: File Naming and Folder Structure Compliance
run: |
Expand Down
2 changes: 1 addition & 1 deletion COPYRIGHT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Inc., except in the case of brief quotations embodied in critical reviews and
certain other noncommercial uses permitted by copyright law.

For permission requests, please contact Daytona Platforms Inc. at
[email protected].
[email protected].