|
1 |
| -# name: PR Creation Workflow |
2 |
| - |
3 |
| -# on: |
4 |
| -# pull_request: |
5 |
| -# types: [opened, edited] |
6 |
| - |
7 |
| -# jobs: |
8 |
| -# check-pr: |
9 |
| -# runs-on: ubuntu-latest |
10 |
| - |
11 |
| -# steps: |
12 |
| -# - name: Checkout repository |
13 |
| -# uses: actions/checkout@v4 |
14 |
| - |
15 |
| -# - name: Set up Node.js |
16 |
| -# uses: actions/setup-node@v4 |
17 |
| -# with: |
18 |
| -# node-version: '14' |
19 |
| - |
20 |
| -# - name: Validate PR Description |
21 |
| -# id: validate-pr |
22 |
| -# run: | |
23 |
| -# pr_body="${{ github.event.pull_request.body }}" |
24 |
| -# required_checkboxes=( |
25 |
| -# "I have performed a self-review of my code." |
26 |
| -# "I have read and followed the Contribution Guidelines." |
27 |
| -# "I have tested the changes thoroughly before submitting this pull request." |
28 |
| -# "I have provided relevant issue numbers, screenshots, and videos after making the changes." |
29 |
| -# "I have commented my code, particularly in hard-to-understand areas." |
30 |
| -# "I have followed the code style guidelines of this project." |
31 |
| -# "I have checked for any existing open issues that my pull request may address." |
32 |
| -# "I have ensured that my changes do not break any existing functionality." |
33 |
| -# "Each contributor is allowed to create a maximum of 4 issues per day. This helps us manage and address issues efficiently." |
34 |
| -# "I have read the resources for guidance listed below." |
35 |
| -# "I have not used AI-generated content (e.g., ChatGPT, other AI tools)." |
36 |
| -# "I have not used content from existing sites (e.g., text, images)." |
37 |
| -# "I have followed all security rules and only shared trusted resources." |
38 |
| -# ) |
39 |
| -# for checkbox in "${required_checkboxes[@]}"; do |
40 |
| -# if [[ "$pr_body" != *"$checkbox"* ]]; then |
41 |
| -# echo "Missing required checkbox: $checkbox" |
42 |
| -# exit 1 |
43 |
| -# fi |
44 |
| -# done |
45 |
| - |
46 |
| -# - name: Retrieve Contributors |
47 |
| -# run: | |
48 |
| -# CONTRIBUTORS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/contributors | jq -r '.[].login') |
49 |
| -# echo "::set-output name=contributors::$CONTRIBUTORS" |
50 |
| - |
51 |
| -# - name: Count Open Issues for Each Contributor |
52 |
| -# id: count-issues |
53 |
| -# run: | |
54 |
| -# for contributor in ${{ steps.retrieve-contributors.outputs.contributors }}; do |
55 |
| -# 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') |
56 |
| -# echo "::set-output name=${contributor}_issue_count::$ISSUE_COUNT" |
57 |
| -# done |
58 |
| - |
59 |
| -# - name: Check Contributor's Open Issues Count |
60 |
| -# run: | |
61 |
| -# contributor=${{ github.event.pull_request.user.login }} |
62 |
| -# issue_count=${{ steps.count-issues.outputs["${contributor}_issue_count"] }} |
63 |
| -# if [ "$issue_count" -ge 4 ]; then |
64 |
| -# echo "Contributor $contributor has $issue_count open issues. Please complete your existing open issues before creating a new one." |
65 |
| -# exit 1 |
66 |
| -# fi |
67 |
| - |
68 | 1 | name: PR Creation Workflow
|
69 | 2 |
|
70 | 3 | on:
|
@@ -111,24 +44,91 @@ jobs:
|
111 | 44 | done
|
112 | 45 |
|
113 | 46 | - name: Retrieve Contributors
|
114 |
| - id: retrieve-contributors |
115 | 47 | run: |
|
116 | 48 | CONTRIBUTORS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/contributors | jq -r '.[].login')
|
117 |
| - echo "contributors=$CONTRIBUTORS" >> $GITHUB_ENV |
| 49 | + echo "::set-output name=contributors::$CONTRIBUTORS" |
118 | 50 |
|
119 | 51 | - name: Count Open Issues for Each Contributor
|
120 | 52 | id: count-issues
|
121 | 53 | run: |
|
122 |
| - for contributor in ${{ env.contributors }}; do |
| 54 | + for contributor in ${{ steps.retrieve-contributors.outputs.contributors }}; do |
123 | 55 | 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')
|
124 |
| - echo "${contributor}_issue_count=$ISSUE_COUNT" >> $GITHUB_ENV |
| 56 | + echo "::set-output name=${contributor}_issue_count::$ISSUE_COUNT" |
125 | 57 | done
|
126 | 58 |
|
127 | 59 | - name: Check Contributor's Open Issues Count
|
128 | 60 | run: |
|
129 | 61 | contributor=${{ github.event.pull_request.user.login }}
|
130 |
| - issue_count=$(printenv | grep "${contributor}_issue_count" | cut -d '=' -f2) |
| 62 | + issue_count=${{ steps.count-issues.outputs["${contributor}_issue_count"] }} |
131 | 63 | if [ "$issue_count" -ge 4 ]; then
|
132 | 64 | echo "Contributor $contributor has $issue_count open issues. Please complete your existing open issues before creating a new one."
|
133 | 65 | exit 1
|
134 | 66 | fi
|
| 67 | +
|
| 68 | +# name: PR Creation Workflow |
| 69 | + |
| 70 | +# on: |
| 71 | +# pull_request: |
| 72 | +# types: [opened, edited] |
| 73 | + |
| 74 | +# jobs: |
| 75 | +# check-pr: |
| 76 | +# runs-on: ubuntu-latest |
| 77 | + |
| 78 | +# steps: |
| 79 | +# - name: Checkout repository |
| 80 | +# uses: actions/checkout@v4 |
| 81 | + |
| 82 | +# - name: Set up Node.js |
| 83 | +# uses: actions/setup-node@v4 |
| 84 | +# with: |
| 85 | +# node-version: '14' |
| 86 | + |
| 87 | +# - name: Validate PR Description |
| 88 | +# id: validate-pr |
| 89 | +# run: | |
| 90 | +# pr_body="${{ github.event.pull_request.body }}" |
| 91 | +# required_checkboxes=( |
| 92 | +# "I have performed a self-review of my code." |
| 93 | +# "I have read and followed the Contribution Guidelines." |
| 94 | +# "I have tested the changes thoroughly before submitting this pull request." |
| 95 | +# "I have provided relevant issue numbers, screenshots, and videos after making the changes." |
| 96 | +# "I have commented my code, particularly in hard-to-understand areas." |
| 97 | +# "I have followed the code style guidelines of this project." |
| 98 | +# "I have checked for any existing open issues that my pull request may address." |
| 99 | +# "I have ensured that my changes do not break any existing functionality." |
| 100 | +# "Each contributor is allowed to create a maximum of 4 issues per day. This helps us manage and address issues efficiently." |
| 101 | +# "I have read the resources for guidance listed below." |
| 102 | +# "I have not used AI-generated content (e.g., ChatGPT, other AI tools)." |
| 103 | +# "I have not used content from existing sites (e.g., text, images)." |
| 104 | +# "I have followed all security rules and only shared trusted resources." |
| 105 | +# ) |
| 106 | +# for checkbox in "${required_checkboxes[@]}"; do |
| 107 | +# if [[ "$pr_body" != *"$checkbox"* ]]; then |
| 108 | +# echo "Missing required checkbox: $checkbox" |
| 109 | +# exit 1 |
| 110 | +# fi |
| 111 | +# done |
| 112 | + |
| 113 | +# - name: Retrieve Contributors |
| 114 | +# id: retrieve-contributors |
| 115 | +# run: | |
| 116 | +# CONTRIBUTORS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/contributors | jq -r '.[].login') |
| 117 | +# echo "contributors=$CONTRIBUTORS" >> $GITHUB_ENV |
| 118 | + |
| 119 | +# - name: Count Open Issues for Each Contributor |
| 120 | +# id: count-issues |
| 121 | +# run: | |
| 122 | +# for contributor in ${{ env.contributors }}; do |
| 123 | +# 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') |
| 124 | +# echo "${contributor}_issue_count=$ISSUE_COUNT" >> $GITHUB_ENV |
| 125 | +# done |
| 126 | + |
| 127 | +# - name: Check Contributor's Open Issues Count |
| 128 | +# run: | |
| 129 | +# contributor=${{ github.event.pull_request.user.login }} |
| 130 | +# issue_count=$(printenv | grep "${contributor}_issue_count" | cut -d '=' -f2) |
| 131 | +# if [ "$issue_count" -ge 4 ]; then |
| 132 | +# echo "Contributor $contributor has $issue_count open issues. Please complete your existing open issues before creating a new one." |
| 133 | +# exit 1 |
| 134 | +# fi |
0 commit comments