Skip to content

Commit 67095e2

Browse files
authored
Merge branch 'main' into 4389-docs-improvments---css
2 parents ef1cbd8 + 0b7b9dd commit 67095e2

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

.github/workflows/scheduled-check-links.yaml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,49 @@ jobs:
7474
run: |
7575
echo "::notice::No broken links were detected"
7676
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
78101
id: create-issue
79102
if: ${{ steps.run-link-checker.outcome == 'failure' }}
103+
env:
104+
ARTIFACT: ${{ env.artifact }}
80105
uses: actions/github-script@v6
81106
with:
82107
script: |
108+
const { ARTIFACT } = process.env
83109
var fs = require('fs');
84-
var bodyMsg = fs.readFileSync('broken_links.md','utf8');
110+
//
85111
failMsg = ':bug: Broken links detected'
86112
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+
87120
github.rest.issues.create({
88121
owner: context.repo.owner,
89122
repo: context.repo.repo,

0 commit comments

Comments
 (0)