Skip to content
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
17 changes: 11 additions & 6 deletions .claude/rules/pr-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ When creating pull requests for sentry-docs, use the following format:
## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the due date. You can update this information later by editing the PR description.

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
- Please give the docs team up to 1 week to review your PR unless you've supplied a deadline.

Thanks in advance for your help!

## PRE-MERGE CHECKLIST

*Make sure you've checked the following before merging your changes:*
_Make sure you've checked the following before merging your changes:_

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts)
Expand All @@ -36,7 +39,9 @@ Thanks in advance for your help!

## Notes

- Default urgency to "None" unless the user specifies otherwise
- Keep the "IS YOUR CHANGE URGENT?" section in every PR description
- Default urgency to "No deadline" unless the user specifies otherwise
- Use `YYYY-MM-DD` for urgent and other deadline dates
- Include preview URLs when relevant (Vercel deploys preview URLs automatically)
- Keep the "DESCRIBE YOUR PR" section concise but informative
- Use bullet points for multiple discrete changes
20 changes: 12 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. -->
<!-- Keep the urgency section so automation can prioritize this PR. You may delete other sections you don't need. -->

## DESCRIBE YOUR PR
*Tell us what you're changing and why. If your PR **resolves an issue**, please link it so it closes automatically.*

## IS YOUR CHANGE URGENT?
_Tell us what you're changing and why. If your PR **resolves an issue**, please link it so it closes automatically._

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [ ] None: Not urgent, can wait up to 1 week+
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the due date. You can update this information later by editing the PR description.

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [ ] No deadline: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
- Please give the docs team up to 1 week to review your PR unless you've supplied a deadline.

Thanks in advance for your help!

## PRE-MERGE CHECKLIST

*Make sure you've checked the following before merging your changes:*
_Make sure you've checked the following before merging your changes:_

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts)
Expand Down
75 changes: 50 additions & 25 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,33 @@
color: F6F6F8
description: Pull requests that update a dependency file

# Issue types
# Docs issue categories
- name: Docs
color: ededed
description: Documentation content issues
- name: 'Docs Content'
color: 26b5ce
- name: 'Docs Platform'
color: ededed
description: Documentation site and tooling issues

# Legacy issue types
- name: 'Type: Content'
color: FBCA04
- name: 'Type: Platform'
color: 1D76DB

#
- name: 'Develop'
color: F6F6F8

# Impacts
- name: 'Impact: Large'
color: C83852
- name: 'Impact: Medium'
color: FFB287
- name: 'Impact: Small'
color: '452650'
# PR priorities
- name: 'Priority: Urgent'
color: B60205
description: Docs review is needed immediately for an urgent deadline
- name: 'Priority: Deadline'
color: D93F0B
description: Docs review has a specific non-urgent due date
- name: 'Priority: Needs Triage'
color: FBCA04
description: The PR description is missing valid priority information
- name: 'Priority: Normal'
color: 0E8A16
description: Docs review has no urgent deadline

# Platforms
- name: 'Platform: .NET'
Expand Down Expand Up @@ -94,6 +104,10 @@
color: '8D5494'
- name: 'Stale'
color: '8D5494'
- name: 'State: Unreproducible'
color: f2994a
- name: "State: Won't Do"
color: 95a2b3

# Product Areas - www.notion.so/sentry/473791bae5bf43399d46093050b77bf0
- name: 'Product Area: Unknown'
Expand Down Expand Up @@ -246,8 +260,9 @@
description: team-web-sdk-backend
- name: 'Team: Workflow'
color: 8D5494
- name: 'All SDKs'
color: 1D76DB
- name: 'Team: SDKs'
color: ededed
description: Issues that affect all or multiple SDK teams
- name: 'SDKs'
color: 1D76DB
- name: 'Develop'
Expand All @@ -256,8 +271,6 @@
color: 8D5494
- name: 'Improvement'
color: 8D5494
- name: 'Launch 🚀'
color: 8D5494
- name: 'Product'
color: 8D5494

Expand All @@ -282,12 +295,6 @@
color: 1279F1
- name: duplicate
color: F6F6F8
- name: 'Effort: Large'
color: FBCA04
- name: 'Effort: Medium'
color: FBCA04
- name: 'Effort: Small'
color: FBCA04
- name: enhancement
color: F6F6F8
- name: filler
Expand All @@ -310,7 +317,7 @@
color: F6F6F8
description: Pull requests that update Javascript code
- name: Mobile
color: '584774'
color: f2c94c
- name: performance
color: '584774'
- name: up-for-grabs
Expand All @@ -335,3 +342,21 @@
color: F6F6F8
- name: github_actions
color: F6F6F8
- name: arcade
color: ededed
- name: auth-complex
color: ededed
- name: docs-screenshots
color: ededed
- name: documentation
color: ededed
- name: jared
color: 943CE4
- name: Playwright
color: ededed
- name: Security
color: ededed
- name: stale-image
color: ededed
- name: Supply-Chain-Vuln
color: ededed
173 changes: 62 additions & 111 deletions .github/workflows/codeowner_assignment.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
name: Codeowner assignment

on: [pull_request]
on:
pull_request_target:
types: [opened, edited, reopened, synchronize, ready_for_review]
workflow_dispatch:
inputs:
pr_number:
description: Pull request number to evaluate
required: true
type: number
dry_run:
description: Log reviewer decisions without requesting reviewers
required: true
default: true
type: boolean

permissions:
contents: read

jobs:
codeowner_assignment:
name: Codeowner assignment
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.action != 'edited' ||
github.event.changes.body != null
concurrency:
group: >-
codeowner-assignment-${{ github.event.pull_request.number || inputs.pr_number }}-${{
github.event_name == 'workflow_dispatch' && inputs.dry_run && github.run_id ||
github.event.action == 'edited' && github.run_id || 'assignment' }}
cancel-in-progress: true
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
timeout-minutes: 5

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: token
with:
Expand All @@ -21,116 +43,45 @@ jobs:
owner: ${{ github.repository_owner }}
repositories: |
sentry-docs
permission-pull-requests: write

- name: Parse CODEOWNERS and assign reviewers
id: assign-reviewers
- name: Resolve trusted base commit
id: base
env:
PR_NUMBER: ${{ github.event.number }}
EVENT_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ steps.token.outputs.token }}
run: |
# locate CODEOWNERS file exists
if [[ -f .github/CODEOWNERS ]]; then
codeowner_path=".github/CODEOWNERS"
elif [[ -f CODEOWNERS ]]; then
codeowner_path="CODEOWNERS"
else
echo "CODEOWNERS file not found, skipping."
exit 0
base_sha="$EVENT_BASE_SHA"
if [[ -z "$base_sha" ]]; then
base_sha=$(gh api "repos/$REPOSITORY/pulls/$PR_NUMBER" --jq '.base.sha')
fi
if [[ ! "$base_sha" =~ ^[0-9a-f]{40}$ ]]; then
echo "Invalid base commit SHA" >&2
exit 1
fi
echo "sha=$base_sha" >> "$GITHUB_OUTPUT"

# Get changed files in the PR
CHANGED_FILES=$(gh pr view $PR_NUMBER --json files --jq '.files[].path')

echo "----------------------------------------"
echo "Changed files:"
echo "$CHANGED_FILES" | tr ' ' '\n' | sed 's/^/- /'
echo "----------------------------------------"

# Get existing reviewers
# merge requested teams and users into a single array
REQUESTED_REVIEWERS=$(gh pr view $PR_NUMBER --json reviewRequests --jq '[.reviewRequests[] | if .__typename == "Team" then .slug else .login end]')
echo "Requested reviewers:"
echo "$REQUESTED_REVIEWERS" | tr ' ' '\n' | sed 's/^/- /'
echo "----------------------------------------"

# Parse CODEOWNERS and find commented lines
# Add newline to the end of the file if it doesn't have one, otherwise sed will not read the last line
sed -i -e '$a\' $codeowner_path

while read -r LINE; do
# Skip lines that are not commented, GitHub will take care of un-commented lines
if [[ ! "$LINE" =~ ^# ]]; then continue; fi

# Extract pattern and reviewer from the commented line
PATTERN=$(echo "$LINE" | sed -E 's/^#\s*([^@]+).*$/\1/' | xargs)
# Capture both individual users and GitHub teams reviewers that have "/" in the name
REVIEWERS=$(echo "$LINE" | grep -o "@[a-zA-Z0-9_-]\+\(/[a-zA-Z0-9_-]\+\)\?" | tr '\n' ' ' | xargs)

# Skip if no reviewers found
if [[ -z "$REVIEWERS" ]]; then
continue
fi
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ steps.base.outputs.sha }}
persist-credentials: false

# Convert pattern to a regex for matching
REGEX_PATTERN=$(echo "$PATTERN" | sed -e 's/\./\\./g' -e 's/\*/.*/g' -e 's/\?/./g' -e 's|^/||')
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v4
with:
node-version-file: package.json

# Match changed files to the pattern
for FILE in $CHANGED_FILES; do
# For glob patterns(e.g. "**/"), use a different matching approach
if [[ "$PATTERN" == *"*"* ]]; then
# Special handling for **/ pattern
if [[ "$PATTERN" == "**/"* ]]; then
# Get the filename part after **/
FILENAME=${PATTERN#**/}
# Match either the filename directly or with any path prefix
if [[ "$FILE" == "$FILENAME" ]] || [[ "$FILE" == */"$FILENAME" ]]; then
echo "File $FILE matches glob pattern $PATTERN"
# Assign each reviewer
for REVIEWER in $REVIEWERS; do
# Remove @ symbol from reviewer name
REVIEWER_NAME=${REVIEWER#@}
if [[ "$REQUESTED_REVIEWERS" == *"$REVIEWER_NAME"* ]]; then
echo " - $REVIEWER_NAME is already a requested reviewer, skipping"
else
echo " - Assigning $REVIEWER_NAME to review changes in $FILE"
gh pr edit $PR_NUMBER --add-reviewer "$REVIEWER_NAME"
fi
done
fi
else
# Convert other glob patterns to regex for matching
GLOB_PATTERN=$(echo "$PATTERN" | sed -e 's/\./\\./g' -e 's/\*/.*/g' -e 's/\?/./g')
if [[ "$FILE" =~ $GLOB_PATTERN ]]; then
echo "File $FILE matches glob pattern $PATTERN"
# Assign each reviewer
for REVIEWER in $REVIEWERS; do
# Remove @ symbol from reviewer name
REVIEWER_NAME=${REVIEWER#@}
if [[ "$REQUESTED_REVIEWERS" == *"$REVIEWER_NAME"* ]]; then
echo " - $REVIEWER_NAME is already a requested reviewer, skipping"
else
echo " - Assigning $REVIEWER_NAME to review changes in $FILE"
gh pr edit $PR_NUMBER --add-reviewer "$REVIEWER_NAME"
fi
done
fi
fi
else
# Original directory matching logic
if [[ "$FILE" == ${REGEX_PATTERN}* ]]; then
echo "File $FILE matches pattern $PATTERN"
# Assign each reviewer
for REVIEWER in $REVIEWERS; do
# Remove @ symbol from reviewer name
REVIEWER_NAME=${REVIEWER#@}
if [[ "$REQUESTED_REVIEWERS" == *"$REVIEWER_NAME"* ]]; then
echo " - $REVIEWER_NAME is already a requested reviewer, skipping"
else
echo " - Assigning $REVIEWER_NAME to review changes in $FILE"
gh pr edit $PR_NUMBER --add-reviewer "$REVIEWER_NAME"
fi
done
fi
fi
done
done < $codeowner_path
- name: Evaluate CODEOWNERS and assign reviewers
env:
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
REPOSITORY: ${{ github.repository }}
EVENT_ACTION: ${{ github.event.action || 'workflow_dispatch' }}
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || false }}
GH_TOKEN: ${{ steps.token.outputs.token }}
run: |
args=()
if [[ "$DRY_RUN" == "true" ]]; then
args+=(--dry-run)
fi
node scripts/assign-pr-reviewers.mjs "${args[@]}"
Loading
Loading