[Feature Request]: Addition of easy questions of gfg #43
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-contributor-issues: | ||
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 Contributors | ||
run: | | ||
CONTRIBUTORS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/contributors | jq -r '.[].login') | ||
echo "::set-output name=contributors::$CONTRIBUTORS" | ||
- name: Count Open Issues for Each Contributor | ||
id: count-issues | ||
run: | | ||
for contributor in ${{ steps.retrieve-contributors.outputs.contributors }}; do | ||
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') | ||
echo "::set-output name=${contributor}_issue_count::$ISSUE_COUNT" | ||
done | ||
- name: Check Contributor's Open Issues Count | ||
run: | | ||
Check failure on line 34 in .github/workflows/issue_creation_workflow.yml
|
||
contributor=${{ github.event.issue.user.login }} | ||
issue_count=${{ steps.count-issues.outputs["${contributor}_issue_count"] }} | ||
if [ "$issue_count" -ge 4 ]; then | ||
echo "Contributor $contributor has $issue_count open issues. Please complete your existing open issues before creating a new one." | ||
exit 1 | ||
fi |