Skip to content
Merged
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
25 changes: 25 additions & 0 deletions .github/workflows/pr-approved.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR Approved

on:
pull_request_review:
types: [submitted]

jobs:
handle-approval:
runs-on: ubuntu-latest
if: ${{ github.event.review.state == 'approved' && contains(fromJSON('["MEMBER", "OWNER"]'), github.event.review.author_association) && github.event.pull_request.base.ref == 'main' }}
permissions:
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPOSITORY_NAME: ${{ github.event.repository.full_name }}
steps:
- name: Add approved label and remove pending labels
shell: bash
run: |
gh pr edit $PR_NUMBER --repo $REPOSITORY_NAME \
--add-label "approved" \
--remove-label "pending-first-review" \
--remove-label "pending-maintainer-review" \
--remove-label "pending-community-response"
42 changes: 42 additions & 0 deletions .github/workflows/pr-community-response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR Community Response

on:
issue_comment:
types: [created]
pull_request:
types: [synchronize] # Triggered when new commits are pushed
branches: [main]

jobs:
handle-community-response:
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
REPOSITORY_NAME: ${{ github.event.repository.full_name }}
steps:
- name: Check if PR targets main branch (for issue comments)
if: ${{ github.event.comment }}
id: check-branch
shell: bash
run: |
BASE_BRANCH=$(gh pr view $PR_NUMBER --repo $REPOSITORY_NAME --json baseRefName --jq '.baseRefName')
echo "base_branch=$BASE_BRANCH" >> $GITHUB_OUTPUT

- name: Handle community comment response
if: ${{ github.event.comment && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) && steps.check-branch.outputs.base_branch == 'main' }}
shell: bash
run: |
gh pr edit $PR_NUMBER --repo $REPOSITORY_NAME \
--add-label "pending-maintainer-review" \
--remove-label "pending-community-response"

- name: Handle community code revision (new commits)
if: ${{ github.event.pull_request && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.pull_request.user.type) }}
shell: bash
run: |
gh pr edit $PR_NUMBER --repo $REPOSITORY_NAME \
--add-label "pending-maintainer-review" \
--remove-label "pending-community-response"
47 changes: 47 additions & 0 deletions .github/workflows/pr-maintainer-feedback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: PR Maintainer Feedback

on:
pull_request_review:
types: [submitted]
issue_comment:
types: [created]

jobs:
handle-maintainer-feedback:
runs-on: ubuntu-latest
# Only run on PR comments/reviews from maintainers targeting main branch
if: ${{ (github.event.pull_request && github.event.pull_request.base.ref == 'main' && contains(fromJSON('["MEMBER", "OWNER"]'), github.event.review.author_association)) || (github.event.issue.pull_request && contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association)) }}
permissions:
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
REPOSITORY_NAME: ${{ github.event.repository.full_name }}
steps:
- name: Check if PR targets main branch (for issue comments)
if: ${{ github.event.comment }}
id: check-branch
shell: bash
run: |
BASE_BRANCH=$(gh pr view $PR_NUMBER --repo $REPOSITORY_NAME --json baseRefName --jq '.baseRefName')
echo "base_branch=$BASE_BRANCH" >> $GITHUB_OUTPUT

- name: Handle maintainer feedback on PR reviews
if: ${{ github.event.review && contains(fromJSON('["MEMBER", "OWNER"]'), github.event.review.author_association) }}
shell: bash
run: |
# Remove pending labels and add pending-community-response
gh pr edit $PR_NUMBER --repo $REPOSITORY_NAME \
--remove-label "pending-first-review" \
--remove-label "pending-maintainer-review" \
--add-label "pending-community-response"

- name: Handle maintainer feedback on PR comments
if: ${{ github.event.comment && contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) && steps.check-branch.outputs.base_branch == 'main' }}
shell: bash
run: |
# Remove pending labels and add pending-community-response
gh pr edit $PR_NUMBER --repo $REPOSITORY_NAME \
--remove-label "pending-first-review" \
--remove-label "pending-maintainer-review" \
--add-label "pending-community-response"
22 changes: 22 additions & 0 deletions .github/workflows/pr-opened.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PR Opened

on:
pull_request:
types: [opened]
branches: [main]

jobs:
add-pr-opened-labels:
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPOSITORY_NAME: ${{ github.event.repository.full_name }}
steps:
- name: Add the pending-first-review label for external contributors
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.pull_request.author_association) }}
shell: bash
run: |
gh pr edit $PR_NUMBER --repo $REPOSITORY_NAME --add-label "pending-first-review"
Loading