Skip to content

Commit 1f6f567

Browse files
authored
Update issue_creation_workflow.yml
1 parent be69885 commit 1f6f567

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

.github/workflows/issue_creation_workflow.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [opened]
66

77
jobs:
8-
check-contributor-issues:
8+
check-issue:
99
runs-on: ubuntu-latest
1010

1111
steps:
@@ -17,24 +17,33 @@ jobs:
1717
with:
1818
node-version: '14'
1919

20-
- name: Retrieve Contributors
20+
- name: Retrieve Contributor's Open Issues
21+
id: retrieve-issues
2122
run: |
22-
CONTRIBUTORS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/contributors | jq -r '.[].login')
23-
echo "::set-output name=contributors::$CONTRIBUTORS"
24-
25-
- name: Count Open Issues for Each Contributor
26-
id: count-issues
27-
run: |
28-
for contributor in ${{ steps.retrieve-contributors.outputs.contributors }}; do
29-
ISSUE_COUNT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/search/issues?q=is:open+author:${contributor}+repo:${{ github.repository }}" | jq -r '.total_count')
30-
echo "::set-output name=${contributor}_issue_count::$ISSUE_COUNT"
31-
done
23+
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')
24+
echo "::set-output name=issue_count::$ISSUE_COUNT"
3225
3326
- name: Check Contributor's Open Issues Count
3427
run: |
35-
contributor=${{ github.event.issue.user.login }}
36-
issue_count=${{ steps.count-issues.outputs["${contributor}_issue_count"] }}
28+
issue_count=${{ steps.retrieve-issues.outputs.issue_count }}
3729
if [ "$issue_count" -ge 4 ]; then
38-
echo "Contributor $contributor has $issue_count open issues. Please complete your existing open issues before creating a new one."
30+
echo "Contributor ${{ github.event.issue.user.login }} has $issue_count open issues. Please complete your existing open issues before creating a new one."
31+
exit 1
32+
fi
33+
34+
- name: Validate Issue Content
35+
id: validate-issue
36+
run: |
37+
issue_body="${{ github.event.issue.body }}"
38+
if [[ "$issue_body" == *"AI-generated content"* ]] || [[ "$issue_body" == *"existing sites"* ]]; then
39+
echo "Issue body contains disallowed content."
40+
exit 1
41+
fi
42+
43+
- name: Check for Security and Trust
44+
run: |
45+
issue_body="${{ github.event.issue.body }}"
46+
if [[ "$issue_body" != *"security"* ]] || [[ "$issue_body" != *"trust"* ]]; then
47+
echo "Issue does not mention security or trust."
3948
exit 1
4049
fi

0 commit comments

Comments
 (0)