Skip to content

Conversation

@TravisEz13
Copy link
Member

@TravisEz13 TravisEz13 commented Oct 16, 2025

PR Summary

This pull request introduces a new GitHub composite action for verifying all links in markdown files using PowerShell and the Markdig library. The action is designed for CI/CD workflows and provides robust link extraction, verification, exclusion patterns, and detailed reporting. The main components added include the action definition, supporting PowerShell scripts for parsing and verifying links, and comprehensive documentation.

The most important changes are:

New GitHub Action Implementation

  • Added a composite GitHub Action (action.yml) that detects changed markdown files in pull requests or pushes, runs link verification only on those files, and outputs verification metrics for use in downstream steps. The action supports parameters for file paths, exclusion patterns, timeouts, and error handling.

PowerShell Link Verification Scripts

  • Introduced Verify-MarkdownLinks.ps1, a script that extracts links from markdown files, deduplicates them, verifies each (supporting HTTP/HTTPS and local files), applies exclusion patterns, and prints a summary with error details. Exits with a nonzero code if failures are found and requested.
  • Added Parse-MarkdownLink.ps1, a script that uses Markdig to parse markdown files and extract all types of links (inline, reference, autolink), returning structured information including file, line, and column.

Documentation

  • Added a detailed README.md documenting the action's features, usage, configuration options, outputs, requirements, and example workflows.

PR Context

PR Checklist

TravisEz13 and others added 11 commits October 15, 2025 13:47
- Implement Parse-ChangelogLinks.ps1 to parse markdown files and extract links.
- Create Verify-MarkdownLinks.ps1 to verify the accessibility of extracted links.
- Define action.yml for the markdown link verification action with necessary inputs and outputs.
- Add README.md to document usage and features of the markdown link verification action.
- Set up verify-markdown-links.yml workflow to automate link verification on push and pull request events.
…403, 429) and improve error reporting for failed links
…trying with GET for specific status codes (404, 405)
This reverts commit 60ec84e.
@TravisEz13 TravisEz13 added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Oct 16, 2025
@xtqqczze
Copy link
Contributor

xtqqczze commented Oct 17, 2025

I'm not sure Invoke-WebRequest is viable approach to check links anymore due to errors. You might consider using Playwright to run a headless browser instead, see https://github.com/orgs/community/discussions/174098#discussioncomment-14461226.

@TravisEz13
Copy link
Member Author

TravisEz13 commented Oct 17, 2025

I'm not sure Invoke-WebRequest is viable approach to check links anymore due to errors. You might consider using Playwright to run a headless browser instead, see https://github.com/orgs/community/discussions/174098#discussioncomment-14461226.

GitHub**curl https://www.npmjs.com/ returns 403 · community · Discussion #174098**Select Topic Area Question Body Hi. I've noticed that something within the last 24 hours, HTTP requests to any path on https://www.npmjs.com returns an HTTP 403 when run outside of the browser. For...

Invoke-WebRequest is adequate for now. I verified the script on every link in the repo.

GitHub
Select Topic Area Question Body Hi. I've noticed that something within the last 24 hours, HTTP requests to any path on https://www.npmjs.com returns an HTTP 403 when run outside of the browser. For...

@TravisEz13 TravisEz13 mentioned this pull request Oct 17, 2025
12 tasks
@TravisEz13
Copy link
Member Author

/azp run PowerShell-CI-linux-packaging, PowerShell-Windows-Packaging-CI

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@TravisEz13 TravisEz13 requested a review from Copilot October 17, 2025 17:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive GitHub Actions workflow and composite action for verifying markdown links. The solution provides automated link validation for pull requests and scheduled runs, using PowerShell and the Markdig library to parse markdown files and verify both HTTP/HTTPS and local file links.

  • New GitHub Action Implementation: Creates a composite action that detects changed markdown files and runs link verification with configurable timeouts, retries, and exclusion patterns
  • PowerShell Scripts for Link Processing: Implements robust markdown parsing and link verification with detailed error reporting and metrics output
  • Documentation and Workflow Configuration: Adds comprehensive documentation and example workflow configurations for CI/CD integration

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/verify-markdown-links.yml Workflow configuration that triggers link verification on markdown file changes and scheduled runs
.github/instructions/powershell-parameter-naming.instructions.md Documentation defining PowerShell parameter naming conventions for consistency
.github/actions/infrastructure/markdownlinks/action.yml Composite action definition with input/output specifications and step implementations
.github/actions/infrastructure/markdownlinks/Verify-MarkdownLinks.ps1 Main verification script that processes links, handles retries, and generates detailed reports
.github/actions/infrastructure/markdownlinks/README.md Comprehensive documentation with usage examples, configuration options, and testing instructions
.github/actions/infrastructure/markdownlinks/Parse-MarkdownLink.ps1 Markdown parsing script using Markdig to extract various link types from markdown files

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@TravisEz13 TravisEz13 marked this pull request as ready for review October 17, 2025 18:01
@TravisEz13 TravisEz13 enabled auto-merge (squash) October 21, 2025 20:25
@TravisEz13 TravisEz13 merged commit 7bcdda7 into master Oct 21, 2025
36 checks passed
@microsoft-github-policy-service
Copy link
Contributor

microsoft-github-policy-service bot commented Oct 21, 2025

📣 Hey @@TravisEz13, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

pwshBot pushed a commit to pwshBot/PowerShell that referenced this pull request Oct 29, 2025
Copilot AI pushed a commit to TravisEz13/PowerShell that referenced this pull request Nov 7, 2025
Copilot AI pushed a commit to TravisEz13/PowerShell that referenced this pull request Nov 7, 2025
Copilot AI pushed a commit to TravisEz13/PowerShell that referenced this pull request Nov 7, 2025
TravisEz13 added a commit to TravisEz13/PowerShell that referenced this pull request Nov 8, 2025
TravisEz13 added a commit to TravisEz13/PowerShell that referenced this pull request Nov 13, 2025
SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request Dec 12, 2025
kilasuit pushed a commit to kilasuit/PowerShell that referenced this pull request Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.4.x-Migrated Backport-7.5.x-Migrated Backport-7.6.x-Migrated CL-Test Indicates that a PR should be marked as a test change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants