Skip to content
Merged
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
72 changes: 72 additions & 0 deletions .github/workflows/auto-assign-core-team.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Auto-assign PRs to core team authors

on:
pull_request_target:
types: [opened, reopened, ready_for_review, converted_to_draft]

permissions:
pull-requests: write
contents: read

jobs:
auto_assign:
name: Assign PR author when core team member
runs-on: ubuntu-latest
steps:
- name: Check team membership via REST
id: team
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG: QwikDev
TEAM_SLUG: qwik-team
AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
RESPONSE=$(curl -s \
-H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/orgs/${ORG}/teams/${TEAM_SLUG}/memberships/${AUTHOR}")

STATE=$(echo "$RESPONSE" | jq -r '.state // empty')
if [ "$STATE" = "active" ]; then
echo "isCore=true" >> $GITHUB_OUTPUT
else
echo "isCore=false" >> $GITHUB_OUTPUT
fi

- name: Assign PR to author
if: steps.team.outputs.isCore == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
AUTHOR=${{ github.event.pull_request.user.login }}
curl -s -H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-X POST \
-d "{\"assignees\":[\"${AUTHOR}\"]}" \
https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/assignees

- name: Add PR to Qwik Development project
if: steps.team.outputs.isCore == 'true'
uses: actions/add-to-project@v0.6.1
with:
project-url: https://github.com/orgs/QwikDev/projects/1
github-token: ${{ secrets.QWIK_API_TOKEN_GITHUB }}

- name: Ensure project + set Status to "In progress" (draft)
if: steps.team.outputs.isCore == 'true' && github.event.pull_request.draft == true
uses: actions/add-to-project@v0.6.1
with:
project-url: https://github.com/orgs/QwikDev/projects/1
github-token: ${{ secrets.QWIK_API_TOKEN_GITHUB }}
fields: |
Status: In progress

- name: Ensure project + set Status to "Waiting For Review" (ready)
if: steps.team.outputs.isCore == 'true' && github.event.pull_request.draft == false
uses: actions/add-to-project@v0.6.1
with:
project-url: https://github.com/orgs/QwikDev/projects/1
github-token: ${{ secrets.QWIK_API_TOKEN_GITHUB }}
fields: |
Status: Waiting For Review