Skip to content

Commit eb74405

Browse files
committed
add comments
1 parent 3cb26ea commit eb74405

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

.github/workflows/check-url-changes.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
name: Documentation & Navigation Change Checker
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
branches:
66
- url-test
77

88
jobs:
99
check-doc-nav-changes:
1010
runs-on: ubuntu-latest
1111
steps:
12-
# 1️⃣ Checkout PR branch safely (fork-safe)
1312
- name: Checkout PR branch
1413
uses: actions/checkout@v4
1514
with:
1615
fetch-depth: 0
1716
ref: ${{ github.event.pull_request.head.ref }}
1817
repository: ${{ github.event.pull_request.head.repo.full_name }}
1918

20-
# 2️⃣ Fetch base branch for diffs
2119
- name: Fetch base branch
2220
run: git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1
2321

24-
# 3️⃣ Detect deleted, renamed, and modified files
2522
- name: Identify .md and .nav changes
2623
run: |
2724
BASE=origin/${{ github.event.pull_request.base.ref }}
@@ -41,7 +38,6 @@ jobs:
4138
for f in $MODIFIED_NAV; do DIFF=$(git diff $BASE $HEAD -- "$f" | grep -vE '^\+\+\+|^---'); NAV_CHANGES+="$f:\n$DIFF\n\n"; done
4239
for f in $RENAMED_NAV; do NAV_CHANGES+="$f [RENAMED]\n\n"; done
4340
44-
# Export to environment
4541
echo "DELETED_MD<<EOF" >> $GITHUB_ENV
4642
echo "$DELETED_MD" >> $GITHUB_ENV
4743
echo "EOF" >> $GITHUB_ENV
@@ -54,15 +50,13 @@ jobs:
5450
echo -e "$NAV_CHANGES" >> $GITHUB_ENV
5551
echo "EOF" >> $GITHUB_ENV
5652
57-
# Set warning flag
5853
if [ -n "$DELETED_MD$RENAMED_MD$NAV_CHANGES" ]; then
5954
echo "warning=true" >> $GITHUB_ENV
6055
else
6156
echo "warning=false" >> $GITHUB_ENV
6257
fi
6358
64-
# 4️⃣ Post PR comment if relevant
65-
- name: Post PR comment
59+
- name: Post PR comment if relevant
6660
if: env.warning == 'true'
6761
uses: actions/github-script@v7
6862
with:
@@ -72,15 +66,14 @@ jobs:
7266
const renamedMd = `${process.env.RENAMED_MD}`.trim();
7367
const navChanges = `${process.env.NAV_CHANGES}`.trim();
7468
75-
// Your requested start message
76-
let message = `🔍 **Documentation URL Checker**\n\nThis PR modifies documentation files in ways that could potentially create broken links.\n\n`;
69+
let message = '🔍 **Documentation & Navigation Checker**\n\nThis PR modifies `.md` or `.nav.yml/.nav.yaml` files.\n\n';
7770
7871
if (deletedMd) message += `**Deleted Markdown files:**\n\`\`\`\n${deletedMd}\n\`\`\`\n\n`;
7972
if (renamedMd) message += `**Renamed Markdown files:**\n\`\`\`\n${renamedMd}\n\`\`\`\n\n`;
8073
if (navChanges) message += `**Navigation file changes:**\n\`\`\`\n${navChanges}\n\`\`\`\n\n`;
8174
82-
// Your requested end message
83-
message += `🚨 Please review these changes carefully 🚨\n\n If not handled properly, broken links (404 errors) could appear. To maintain a smooth user experience, consider:\n- Adding redirects in the \`mkdocs.yml\` file from the old URLs to the new ones\n- Updating internal references to these files`;
75+
message += '🚨 Please verify:\n- Links are correct\n- TOC matches expected structure\n- Deleted/renamed entries are handled. \n\n If not handled properly, broken links (404 errors) could appear. To maintain a smooth user experience, consider:\n- Adding redirects in the \`mkdocs.yml\` file from the old URLs to the new ones\n- Updating internal references to these files`;
76+
8477

8578
github.rest.issues.createComment({
8679
owner: context.repo.owner,

0 commit comments

Comments
 (0)