-
-
Notifications
You must be signed in to change notification settings - Fork 158
49 lines (41 loc) · 1.67 KB
/
issue_creation_workflow.yml
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
name: Issue Creation Workflow
on:
issues:
types: [opened]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Retrieve Contributor's Open Issues
id: retrieve-issues
run: |
ISSUE_COUNT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/search/issues?q=is:open+author:${{ github.event.issue.user.login }}+repo:${{ github.repository }}" | jq -r '.total_count')
echo "::set-output name=issue_count::$ISSUE_COUNT"
- name: Check Contributor's Open Issues Count
run: |
issue_count=${{ steps.retrieve-issues.outputs.issue_count }}
if [ "$issue_count" -ge 4 ]; then
echo "Contributor ${{ github.event.issue.user.login }} has $issue_count open issues. Please complete your existing open issues before creating a new one."
exit 1
fi
- name: Validate Issue Content
id: validate-issue
run: |
issue_body="${{ github.event.issue.body }}"
if [[ "$issue_body" == *"AI-generated content"* ]] || [[ "$issue_body" == *"existing sites"* ]]; then
echo "Issue body contains disallowed content."
exit 1
fi
- name: Check for Security and Trust
run: |
issue_body="${{ github.event.issue.body }}"
if [[ "$issue_body" != *"security"* ]] || [[ "$issue_body" != *"trust"* ]]; then
echo "Issue does not mention security or trust."
exit 1
fi