@@ -74,16 +74,49 @@ jobs:
74
74
run : |
75
75
echo "::notice::No broken links were detected"
76
76
77
- - name : Create issue from Markdown file
77
+ - name : check message size
78
+ id : check-msg-size
79
+ if : ${{ steps.run-link-checker.outcome == 'failure' }}
80
+ run : |
81
+ artifact="false"
82
+ sizeOfMessage=$(cat broken_links.md | wc -c)
83
+ # the size of a comment in an issue is 65536
84
+ if [ "${sizeOfMessage}" -gt 650000 ]; then
85
+ # we'll need to store the broken_links.md file as an aritifact
86
+ artifact="true"
87
+ fi
88
+
89
+ echo "artifact=${artifact}" >> $GITHUB_ENV
90
+
91
+ - name : Upload artifact if applicable
92
+ id : upload-artifact
93
+ if : ${{ steps.run-link-checker.outcome == 'failure' && env.artifact == 'true' }}
94
+ uses : actions/upload-artifact@v4
95
+ with :
96
+ name : broken-links
97
+ path : |
98
+ ${{ github.action_path }}/broken_links.md
99
+
100
+ - name : Create issue
78
101
id : create-issue
79
102
if : ${{ steps.run-link-checker.outcome == 'failure' }}
103
+ env :
104
+ ARTIFACT : ${{ env.artifact }}
80
105
uses : actions/github-script@v6
81
106
with :
82
107
script : |
108
+ const { ARTIFACT } = process.env
83
109
var fs = require('fs');
84
- var bodyMsg = fs.readFileSync('broken_links.md','utf8');
110
+ //
85
111
failMsg = ':bug: Broken links detected'
86
112
113
+ if ('true' == ARTIFACT) {
114
+ address = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}#artifacts`
115
+ var bodyMsg = `Visual Regression Testing failed. Please view the report artifact at ${address}`
116
+ } else {
117
+ var bodyMsg = fs.readFileSync('broken_links.md','utf8');
118
+ }
119
+
87
120
github.rest.issues.create({
88
121
owner: context.repo.owner,
89
122
repo: context.repo.repo,
0 commit comments