@@ -151,7 +151,7 @@ runs:
151151 run : |
152152 # DNSControl check
153153 set +e
154- DNSCONTROL_CMD=$($DNSCONTROL check --config "$DNSCONFIG_FILE")
154+ DNSCONTROL_CMD=$($DNSCONTROL check --config "$DNSCONFIG_FILE" 2>&1 )
155155 err=$?
156156 export DNSCONTROL_CMD
157157 DELIMITER="DNSCONTROL-$RANDOM"
@@ -163,6 +163,29 @@ runs:
163163 echo "$DNSCONTROL_CMD"
164164 exit $err
165165
166+ - name : Attach Check Results as PR comment
167+ uses : thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
168+ # execute if user set post_pr_comment, this is a PR event, AND dnscontrol check ran and failed
169+ if : ${{
170+ inputs.post_pr_comment &&
171+ github.event.pull_request.number != '' &&
172+ (
173+ steps.check.outcome != 'skipped' &&
174+ steps.check.outcome != 'success'
175+ ) }}
176+ with :
177+ # comment-tag must be the same for both PR comment steps so they update the same comment
178+ comment-tag : dnscontrol_composite_action
179+ message : |
180+ <details open><summary>DNSControl Check Results</summary>
181+
182+ ### DNSControl Check Results
183+
184+ ```
185+ ${{ steps.check.outputs.output }}
186+ ```
187+ </details>
188+
166189 - name : Check Summary
167190 # write check output to job summary if check failed
168191 if : ${{ steps.check.outcome != 'success' && steps.check.outcome != 'skipped' }}
@@ -187,7 +210,7 @@ runs:
187210 run : |
188211 # DNSControl
189212 set +e
190- DNSCONTROL_CMD=$($DNSCONTROL $DNSCONTROL_COMMAND --config "$DNSCONFIG_FILE" $CREDS_ARG)
213+ DNSCONTROL_CMD=$($DNSCONTROL $DNSCONTROL_COMMAND --config "$DNSCONFIG_FILE" $CREDS_ARG 2>&1 )
191214 err=$?
192215 DELIMITER="DNSCONTROL-$RANDOM"
193216 {
@@ -236,3 +259,11 @@ runs:
236259 run : |
237260 # Job Summary
238261 echo "$OUTPUT" >>"$GITHUB_STEP_SUMMARY"
262+
263+ - name : Action failed
264+ if : ${{ steps.dnscontrol.outcome != 'skipped' && steps.dnscontrol.outcome != 'success' }}
265+ shell : bash
266+ run : |
267+ # Action failed
268+ echo "DNSControl command failed"
269+ exit 1
0 commit comments