Skip to content

Commit 032b947

Browse files
Merging changes from main into catalina/azure-auto-snapshots-doc
2 parents 870a28b + 5900484 commit 032b947

File tree

1,299 files changed

+89433
-1558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,299 files changed

+89433
-1558
lines changed

.github/workflows/broken-link-check-full.yml

Lines changed: 109 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Broken Link Check (full)
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: "0 0 1 * *"
6+
- cron: '0 0 * * 1'
77

88
jobs:
99
link-checker:
@@ -42,25 +42,125 @@ jobs:
4242
days-before-issue-stale: 0
4343
# Idle number of days before closing old issues
4444
days-before-issue-close: 0
45-
close-issue-message: "This issue was closed because an updated Link Checker Report has been generated."
45+
close-issue-message: 'This issue was closed because an updated Link Checker Report has been generated.'
4646
repo-token: ${{ secrets.GITHUB_TOKEN }}
4747

48-
- name: Create GitHub Issue From lychee output file
48+
- name: Generate enhanced issue content with categorization
49+
if: steps.lychee.outputs.exit_code != 0
50+
run: |
51+
# Count different types of broken links
52+
TOTAL_COUNT=$(grep -c "✗" ./lychee/out.md || echo "0")
53+
54+
# Define HashiCorp domains (easily maintainable list)
55+
HASHICORP_DOMAINS="hashicorp\.com|hashicorp\.io|terraform\.io|consul\.io|vault\.io|nomad\.io|packer\.io|vagrant\.io|waypoint\.io|boundary\.io|hcp\.io"
56+
57+
# Count internal HashiCorp links using the dynamic list
58+
INTERNAL_COUNT=$(grep -E "✗.*($HASHICORP_DOMAINS)" ./lychee/out.md | wc -l || echo "0")
59+
60+
EXTERNAL_COUNT=$((TOTAL_COUNT - INTERNAL_COUNT))
61+
62+
# Create enhanced issue content
63+
cat > ./issue-content.md << EOF
64+
# 🔗 Weekly Link Checker Report - $(date '+%B %Y')
65+
66+
## 📊 Summary
67+
68+
- **Total broken links**: $TOTAL_COUNT
69+
- **Internal HashiCorp links**: $INTERNAL_COUNT 🚨
70+
- **External links**: $EXTERNAL_COUNT ⚠️
71+
- **Scan date**: $(date '+%Y-%m-%d')
72+
- **Content scanned**: All \`/content/\` directories
73+
74+
## 🎯 Prioritization Guide
75+
76+
When reviewing broken links, prioritize fixes in this order:
77+
78+
1. **🚨 High Priority**: Internal HashiCorp links (developer.hashicorp.com, etc.)
79+
2. **⚠️ Medium Priority**: External documentation/API references users rely on
80+
3. **ℹ️ Low Priority**: External blog posts, news articles, or optional resources
81+
82+
## 📋 Action Items
83+
84+
- [ ] Review high-priority internal links ($INTERNAL_COUNT found)
85+
- [ ] Check if external links have moved to new URLs
86+
- [ ] Update or remove links that are permanently broken
87+
- [ ] Consider adding warnings for unreliable external sources
88+
89+
## 🔍 Link Details
90+
91+
EOF
92+
93+
# Add the actual lychee output
94+
cat ./lychee/out.md >> ./issue-content.md
95+
96+
# Add footer
97+
cat >> ./issue-content.md << EOF
98+
99+
---
100+
101+
**Note**: This issue is automatically updated weekly. Previous reports are closed when new ones are generated.
102+
103+
For more information, see our [Broken Link Monitoring documentation](.github/BROKEN_LINK_MONITORING.md).
104+
EOF
105+
106+
- name: Create automated GitHub issue with broken link report
49107
id: create_issue
50108
if: steps.lychee.outputs.exit_code != 0
51109
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5.0.1
52110
with:
53-
title: Link Checker Report
54-
content-filepath: ./lychee/out.md
55-
labels: link-checker-report
111+
title: 'Link Checker Report - $(date +"%B %Y")'
112+
content-filepath: ./issue-content.md
113+
labels: |
114+
link-checker-report
115+
content-quality
116+
117+
- name: Log production broken links to Datadog
118+
if: steps.lychee.outputs.exit_code != 0
119+
run: |
120+
BROKEN_COUNT=$(grep -c "✗" ./lychee/out.md || echo "0")
121+
echo "::error::PRODUCTION broken links detected: $BROKEN_COUNT issues affecting end users"
122+
echo "GitHub issue: https://github.com/${{ github.repository }}/issues/${{ steps.create_issue.outputs.issue-number }}"
123+
124+
# Send structured alert to Datadog for production monitoring
125+
curl -X POST "https://http-intake.logs.datadoghq.com/v1/input/${{ secrets.DD_API_KEY }}" \
126+
-H "Content-Type: application/json" \
127+
-d '{
128+
"ddsource": "github-actions",
129+
"ddtags": "environment:production,service:web-unified-docs,alert_type:broken_links_production",
130+
"hostname": "github-actions",
131+
"message": "Production broken links detected: '"$BROKEN_COUNT"' issues affecting end users",
132+
"level": "error",
133+
"broken_link_count": '"$BROKEN_COUNT"',
134+
"issue_url": "https://github.com/${{ github.repository }}/issues/${{ steps.create_issue.outputs.issue-number }}"
135+
}' || echo "Failed to send Datadog alert"
56136
57137
- name: Report success in GitHub Step Summary
58138
if: steps.lychee.outputs.exit_code == 0
59139
run: |
60-
echo "🎉 No broken links found! 🎉" >> $GITHUB_STEP_SUMMARY
61-
exit 0
140+
echo "## Link Health Report - Success!" >> $GITHUB_STEP_SUMMARY
141+
echo "" >> $GITHUB_STEP_SUMMARY
142+
echo " **No broken links found in production content**" >> $GITHUB_STEP_SUMMARY
143+
echo "" >> $GITHUB_STEP_SUMMARY
144+
echo "- **Scan date**: $(date '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
145+
echo "- **Content scanned**: All \`/content/\` directories" >> $GITHUB_STEP_SUMMARY
146+
echo "- **Status**: All links are healthy " >> $GITHUB_STEP_SUMMARY
147+
echo "" >> $GITHUB_STEP_SUMMARY
148+
echo "Great work maintaining high content quality!" >> $GITHUB_STEP_SUMMARY
149+
150+
# Log success to Datadog for trend tracking
151+
curl -X POST "https://http-intake.logs.datadoghq.com/v1/input/${{ secrets.DD_API_KEY }}" \
152+
-H "Content-Type: application/json" \
153+
-d '{
154+
"ddsource": "github-actions",
155+
"ddtags": "environment:production,service:web-unified-docs,alert_type:link_health_success",
156+
"hostname": "github-actions",
157+
"message": "Production link check passed - no broken links found",
158+
"level": "info",
159+
"broken_link_count": 0,
160+
"scan_status": "success"
161+
}' || echo "Failed to send Datadog success metric"
62162
63163
- name: Report failure in GitHub Step Summary
64164
if: steps.lychee.outputs.exit_code != 0
65165
run: |
66-
echo "Broken links found, [check the following Github issue for more information.](https://github.com/${{ github.repository }}/issues/${{ steps.create_issue.outputs.issue-number }})" >> $GITHUB_STEP_SUMMARY
166+
echo "Broken links found, [check the following Github issue for more information.](https://github.com/${{ github.repository }}/issues/${{ steps.create_issue.outputs.issue-number }})" >> $GITHUB_STEP_SUMMARY

.github/workflows/build-pr-preview.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ jobs:
184184
with:
185185
repository: hashicorp/dev-portal
186186
path: ./unified-docs-frontend-preview
187-
188187
- name: Use cache
189188
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
190189
with:
@@ -316,7 +315,25 @@ jobs:
316315
- name: Add Broken Link Checker header to lychee output
317316
if: steps.lychee.outputs.exit_code != 0
318317
run: |
319-
sed -i '1s/^/## Broken Link Checker\n/' ./lychee/out.md
318+
cat > ./lychee/header.md << 'EOF'
319+
## Broken Link Checker
320+
321+
**This PR contains broken links, but won't be blocked.** Use this report to improve content quality:
322+
323+
### Quick Actions
324+
- **Internal links** (HashiCorp sites): Please fix these - they impact user experience
325+
- **External links**: Consider if these are essential or can be updated/removed
326+
- **Temporary issues**: External sites may recover - check again before merging
327+
328+
### Need Help?
329+
- Review our [Broken Link Monitoring docs](.github/BROKEN_LINK_MONITORING.md)
330+
- Check the [monthly production report](https://github.com/hashicorp/web-unified-docs/issues?q=label%3Alink-checker-report+is%3Aopen) for context
331+
332+
---
333+
334+
EOF
335+
cat ./lychee/header.md ./lychee/out.md > ./lychee/final.md
336+
mv ./lychee/final.md ./lychee/out.md
320337
321338
# Get length of lychee output
322339
- name: lychee output size check
@@ -357,14 +374,7 @@ jobs:
357374
header: Link Checker Report
358375
path: ./lychee/out.md
359376

360-
# Fail github action if lychee exit code is anything other than the success code (0)
361-
- name: lychee exit code check
362-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
363-
if: steps.lychee.outputs.exit_code != 0
364-
with:
365-
script: |
366-
core.setFailed('lychee failed with exit code ${{steps.lychee.outputs.exit_code}}')
367-
377+
# Note: PRs never fail due to broken links - this is informational only
368378
# If all previous Github actions run (indicating success), this one will run and overwrite the comment with a success message
369379
- name: Comment on PR about successful link check
370380
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.1

.github/workflows/repo-sync.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
name: Repo Sync
22

3-
# **What it does**: HashiCorp Docs has two repositories: hashicorp/web-unified-docs (public) and hashicorp/web-unified-docs-internal (private).
3+
# HashiCorp Docs has two repositories: hashicorp/web-unified-docs (public) and hashicorp/web-unified-docs-internal (private).
44
# This GitHub Actions workflow keeps the `main` branch of those two repos in sync.
5-
# **Why we have it**: To keep the open-source repository up-to-date
6-
# while still having an internal repository for sensitive work.
7-
# **Who does it impact**: Open-source.
85

96
on:
107
workflow_dispatch:
11-
push:
12-
branches: main
8+
repository_dispatch:
9+
types: [push-repo-sync]
1310

1411
permissions:
1512
contents: write
1613
pull-requests: write
1714

15+
concurrency:
16+
group: repo-sync-${{ github.repository }}
17+
# we don't want to cancel an in progress run
18+
# as it could leave a repo in an inconsistent state
19+
cancel-in-progress: false
20+
1821
jobs:
1922
repo-sync:
2023
if: github.repository == 'hashicorp/web-unified-docs-internal' || github.repository == 'hashicorp/web-unified-docs'
2124
name: Repo Sync
2225
runs-on: ubuntu-latest
2326
steps:
27+
- name: Report the commit that triggered the sync
28+
if: github.event_name == 'repository_dispatch'
29+
run: |
30+
echo "## Repo Sync Triggered" >> $GITHUB_STEP_SUMMARY
31+
echo "Syncing from repository: **${{ github.event.client_payload.repository }}**" >> $GITHUB_STEP_SUMMARY
32+
echo "Source commit: [\`${{ github.event.client_payload.commit }}\`](https://github.com/${{ github.event.client_payload.repository }}/commit/${{ github.event.client_payload.commit }})" >> $GITHUB_STEP_SUMMARY
33+
2434
- name: Check out repo
2535
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 2024-10-28
2636

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Trigger Repo Sync in Other Repo
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
dispatch_workflow:
9+
if: github.repository == 'hashicorp/web-unified-docs-internal' || github.repository == 'hashicorp/web-unified-docs'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Dispatch workflow in target repo
13+
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0
14+
with:
15+
token: ${{ secrets.CI_GITHUB_TOKEN }}
16+
repository: hashicorp/${{ github.repository == 'hashicorp/web-unified-docs-internal' && 'web-unified-docs' || 'web-unified-docs-internal' }}
17+
event-type: push-repo-sync
18+
client-payload: |
19+
{
20+
"repository": "${{ github.repository }}",
21+
"commit": "${{ github.sha }}"
22+
}

0 commit comments

Comments
 (0)