-
Notifications
You must be signed in to change notification settings - Fork 40
42 lines (39 loc) · 1.43 KB
/
validate-issue.yaml
File metadata and controls
42 lines (39 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Validate issue
on:
issues:
types:
- opened
workflow_dispatch:
inputs:
issue_number:
description: 'Issue number to validate'
required: true
type: number
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUMBER: ${{ inputs.issue_number || github.event.issue.number }}
REPO: "uni-stack/uniwind"
jobs:
autoclose:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.issue.labels.*.name, 'uniwind-pro') }}
permissions:
issues: write
steps:
- name: Check for valid reproduction
id: check
if: github.event_name != 'workflow_dispatch'
env:
BODY: ${{ github.event.issue.body }}
run: |
if echo "$BODY" | grep -qP "github\.com\/(?!(uni-stack|user-attachments)\/)[\w\-\.]+\/[\w\-\.]+"; then
echo "valid=true" >> $GITHUB_OUTPUT
else
echo "valid=false" >> $GITHUB_OUTPUT
fi
- name: Close Issue
if: github.event_name == 'workflow_dispatch' || steps.check.outputs.valid == 'false'
run: gh issue close "$NUMBER" --comment "This issue has been automatically closed because it **lacks a clear, minimal reproduction** that we can use to verify the reported bug." --repo "$REPO"
- name: Label Issue
if: github.event_name == 'workflow_dispatch' || steps.check.outputs.valid == 'false'
run: gh issue edit "$NUMBER" --add-label "repro-required" --repo "$REPO"