Skip to content

Commit 17a0a96

Browse files
authored
Try label bot checker (#1252)
stack-info: PR: #1252, branch: drisspg/stack/20
1 parent 242f181 commit 17a0a96

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: PR Label Check
2+
on:
3+
pull_request:
4+
types: [opened, labeled, unlabeled, synchronize]
5+
6+
jobs:
7+
check-labels:
8+
name: Check PR Labels
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check for Topic label
12+
run: |
13+
# Get the labels using GitHub API
14+
LABELS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
15+
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" \
16+
| jq -r '.labels[].name')
17+
18+
# Check if there are any labels
19+
if [ -z "$LABELS" ]; then
20+
echo "::error::This PR requires at least one topic label. Please add a topic from: https://github.com/pytorch/ao/labels?q=topic"
21+
exit 1
22+
fi
23+
24+
# Check for Topic label
25+
if ! echo "$LABELS" | grep -i "topic:" > /dev/null; then
26+
echo "::error::This PR requires at least one label starting with 'topic:'. Available topics can be found at: https://github.com/pytorch/ao/labels?q=topic"
27+
exit 1
28+
fi
29+
30+
echo "PR has required topic label"

0 commit comments

Comments
 (0)