-
Notifications
You must be signed in to change notification settings - Fork 56
59 lines (56 loc) · 2.33 KB
/
Copy pathvalidate-issue.yaml
File metadata and controls
59 lines (56 loc) · 2.33 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
permissions:
issues: write
steps:
- name: Check issue template
id: template
if: github.event_name != 'workflow_dispatch'
env:
BODY: ${{ github.event.issue.body }}
run: |
if echo "$BODY" | grep -qF '〰'; then
echo "valid=true" >> $GITHUB_OUTPUT
else
echo "valid=false" >> $GITHUB_OUTPUT
fi
- name: Close invalid issue
if: github.event_name != 'workflow_dispatch' && steps.template.outputs.valid == 'false'
run: >-
gh issue close "$NUMBER" --comment "This issue must be reported using the official issue templates: **Bug report** or **Bug report (Uniwind Pro)**." --repo "$REPO"
- name: Label invalid issue
if: github.event_name != 'workflow_dispatch' && steps.template.outputs.valid == 'false'
run: gh issue edit "$NUMBER" --add-label "invalid" --repo "$REPO"
- name: Check for valid reproduction
id: check
if: github.event_name != 'workflow_dispatch' && steps.template.outputs.valid == 'true' && !contains(github.event.issue.labels.*.name, 'uniwind-pro')
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 repository with a 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"