[Feature Request]: Solution of Count Digits from gfg #1763
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '14' | |
- 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 |