|
74 | 74 |
|
75 | 75 | echo "SERIES_DIR=/tmp/series" >> $GITHUB_ENV |
76 | 76 |
|
77 | | - - name: Check for label 'no-ml' to skip sending emails |
78 | | - id: checklabel |
79 | | - run: | |
80 | | - # Skip if PR has label "no-ml" |
81 | | - if echo "$PR_LABELS" | grep -qiE "(^|,)no-ml(,|$)"; then |
82 | | - echo "Opt-out label present: skipping mailing list." | tee $GITHUB_STEP_SUMMARY |
83 | | - echo "skip_sending=1" >> $GITHUB_OUTPUT |
84 | | - else |
85 | | - echo "skip_sending=0" >> $GITHUB_OUTPUT |
86 | | - fi |
87 | | -
|
88 | 77 | - name: Get commit list from PR and skip the internal ones |
89 | 78 | id: commits |
90 | | - if: ${{ steps.checklabel.outputs.skip_sending != '1' }} |
91 | 79 | run: | |
92 | 80 | # Skip commits that touches any of these |
93 | 81 | patterns=(".github/" |
@@ -120,20 +108,46 @@ jobs: |
120 | 108 | echo "has_commits=false" >> $GITHUB_OUTPUT |
121 | 109 | else |
122 | 110 | COUNT=$(wc -l < /tmp/commits.txt) |
| 111 | + echo "Adding one commit to the send list" |
123 | 112 | echo "COUNT=$COUNT" >> $GITHUB_ENV |
124 | 113 | echo "has_commits=true" >> $GITHUB_OUTPUT |
125 | 114 | fi |
126 | 115 |
|
127 | 116 | - name: Check what to do based on series' size |
128 | 117 | if: steps.commits.outputs.has_commits == 'true' |
| 118 | + id: count_commits |
129 | 119 | run: | |
130 | 120 | MAX=150 |
131 | 121 | if [ "${COUNT}" -gt "$MAX" ]; then |
132 | 122 | echo "Series has $COUNT commits (> $MAX). Not doing anything" | tee $GITHUB_STEP_SUMMARY |
| 123 | + echo skip=true >> $GITHUB_OUTPUT |
| 124 | + else |
| 125 | + echo "Will send the series" |
| 126 | + echo skip=false >> $GITHUB_OUTPUT |
133 | 127 | fi |
134 | 128 |
|
| 129 | + - name: Check for label 'no-ml' to skip sending emails |
| 130 | + id: checklabel |
| 131 | + run: | |
| 132 | + # Skip if PR has label "no-ml" |
| 133 | + if echo "$PR_LABELS" | grep -qiE "(^|,)no-ml(,|$)"; then |
| 134 | + echo "Opt-out label present: skipping mailing list." | tee $GITHUB_STEP_SUMMARY |
| 135 | + echo "skip=true" >> $GITHUB_OUTPUT |
| 136 | + else |
| 137 | + echo "No opt-out label found" |
| 138 | + echo "skip=false" >> $GITHUB_OUTPUT |
| 139 | + fi |
| 140 | +
|
| 141 | + - name: Decide if we're sending something or not |
| 142 | + id: send_emails |
| 143 | + if: ( steps.commits.outputs.has_commits == 'true' && |
| 144 | + steps.count_commits.outputs.skip == 'false' && |
| 145 | + steps.checklabel.outputs.skip == 'false' ) |
| 146 | + run: | |
| 147 | + echo "enabled=true" >> $GITHUB_OUTPUT |
| 148 | +
|
135 | 149 | - name: Prepare patch series |
136 | | - if: steps.commits.outputs.has_commits == 'true' |
| 150 | + if: steps.send_emails.outputs.enabled == 'true' |
137 | 151 | run: | |
138 | 152 | set -euo pipefail |
139 | 153 |
|
@@ -190,7 +204,7 @@ jobs: |
190 | 204 | done < <(find /tmp/series/ -maxdepth 1 -type f -print0|sort -z -n) |
191 | 205 |
|
192 | 206 | - name: Send series via git send-email |
193 | | - if: steps.commits.outputs.has_commits == 'true' |
| 207 | + if: steps.send_emails.outputs.enabled == 'true' |
194 | 208 | env: |
195 | 209 | GIT_SMTP_SERVER: ${{ secrets.SMTP_SERVER }} |
196 | 210 | GIT_SMTP_ENCRYPTION: tls |
|
0 commit comments