mirror of
https://github.com/uni-stack/uniwind.git
synced 2026-09-14 20:07:03 +08:00
60 lines
2.3 KiB
YAML
60 lines
2.3 KiB
YAML
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"
|