Skip to content

docs(webhooks): only document content arms providers actually emit inbound #65

docs(webhooks): only document content arms providers actually emit inbound

docs(webhooks): only document content arms providers actually emit inbound #65

name: Close stale version PRs
on:
pull_request:
types: [opened]
permissions:
pull-requests: write
jobs:
close-stale:
runs-on: ubuntu-latest
if: startsWith(github.head_ref, 'docs/update-')
steps:
- name: Close older version PRs for the same SDK
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
NEW_PR: ${{ github.event.pull_request.number }}
NEW_BRANCH: ${{ github.head_ref }}
run: |
# Extract SDK name from branch: docs/update-{sdk-name}-v{version}
sdk_name=$(echo "$NEW_BRANCH" | sed 's|^docs/update-||' | sed 's|-v[0-9].*||')
if [ -z "$sdk_name" ]; then
echo "Could not extract SDK name from branch: $NEW_BRANCH"
exit 0
fi
echo "New PR #$NEW_PR for SDK: $sdk_name"
# Find other open PRs for the same SDK
gh pr list --repo "$REPO" --state open --json number,headRefName --jq ".[] | select(.headRefName | startswith(\"docs/update-${sdk_name}-v\")) | .number" | while read -r pr_number; do
if [ "$pr_number" != "$NEW_PR" ]; then
echo "Closing stale PR #$pr_number"
gh pr close "$pr_number" --repo "$REPO" --comment "Superseded by #$NEW_PR which targets a newer version."
fi
done