Skip to content
Open
Changes from 1 commit
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
32 changes: 32 additions & 0 deletions .github/workflows/docs-label-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check that PR has either "needs-docs" or "no-docs"

on:
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]

permissions:
pull-requests: read

jobs:
check-tag:
runs-on: depot-ubuntu-24.04
steps:
- name: check if PR has tag
shell: bash
run: |
labels=$(gh api --jq '.labels.[].name' "/repos/$REPOSITORY/pulls/$PR_NUMBER")
echo "Found labels: $labels"
has_needs_docs=$(echo "$labels" | (grep "needs-docs" || true))
has_no_docs=$(echo "$labels" | (grep "no-docs" || true))
if [[ "$has_needs_docs" != "" && "$has_no_docs" != "" ]]; then
echo "PR must either have label 'no-docs' or 'needs-docs', not both"
exit 1;
elif [[ "$has_needs_docs" = "" && "$has_no_docs" = "" ]]; then
echo "PR must either have label 'no-docs' or 'needs-docs'"
exit 1;
fi
exit 0;
env:
REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
PR_NUMBER: ${{ github.event.number }}
GH_TOKEN: ${{ github.token }}
Loading