Skip to content

Commit

Permalink
Reduce preview PR comment size
Browse files Browse the repository at this point in the history
  • Loading branch information
koenrh committed Jul 24, 2021
1 parent cc3905c commit aedf90a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ LABEL "com.github.actions.color"="yellow"

RUN apk add --no-cache bash

COPY README.md /

COPY entrypoint.sh /entrypoint.sh
COPY README.md entrypoint.sh bin/filter-preview-output.sh /
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ GitHub Action.
with:
msg: |
```
${{ steps.dnscontrol_preview.outputs.output }}
${{ steps.dnscontrol_preview.outputs.preview_comment }}
```
check_for_duplicate_msg: true
```
Expand Down
9 changes: 9 additions & 0 deletions bin/filter-preview-output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# source: https://git.io/J86QD
grep -v -e '^\.\.\.0 corrections$' |\
grep -v -e '^0 corrections' |\
grep -v -e '\.\.\. (skipping)' |\
grep -v -e '^----- DNS Provider: ' |\
grep -v -e '^----- Registrar: ' |\
grep -v -e '^----- Getting nameservers from:'
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@ OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"

# Filter output to reduce 'preview' PR comment length
FILTERED_OUTPUT="$(echo "$OUTPUT" | /filter-preview-output.sh)"

echo "::set-output name=output::$OUTPUT"
echo "::set-output name=preview_comment::$FILTERED_OUTPUT"

exit $EXIT_CODE

0 comments on commit aedf90a

Please sign in to comment.