Skip to content

feat: add workflow to check broken links#327

Open
Abhijeet2409 wants to merge 17 commits into
hiero-ledger:mainfrom
Abhijeet2409:fix-broken-links-workflow
Open

feat: add workflow to check broken links#327
Abhijeet2409 wants to merge 17 commits into
hiero-ledger:mainfrom
Abhijeet2409:fix-broken-links-workflow

Conversation

@Abhijeet2409

@Abhijeet2409 Abhijeet2409 commented Mar 31, 2026

Copy link
Copy Markdown
Member

Description

This PR adds a working bot workflow adapted from the hiero-sdk-python repository.

Changes

  • Configured workflow to run on a suitable GitHub Actions runner
  • Scheduled the workflow to run weekly

Test

Fixes #283

Summary by CodeRabbit

  • Chores
    • Added an automated workflow to check documentation for broken Markdown links on a weekly schedule and when manually triggered.
    • Workflow can run in a dry-run mode for safe checks; in regular runs it files or updates a tracked issue with results so broken links are visible and actionable.

Signed-off-by: Abhijeet Saharan <abhijeetsaharan2236@gmail.com>
@netlify

netlify Bot commented Mar 31, 2026

Copy link
Copy Markdown

Deploy Preview for hiero-open-source ready!

Name Link
🔨 Latest commit f3593ee
🔍 Latest deploy log https://app.netlify.com/projects/hiero-open-source/deploys/6a320bd18e32780008f101dd
😎 Deploy Preview https://deploy-preview-327--hiero-open-source.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@lfdt-bot

lfdt-bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codacy-production

codacy-production Bot commented Mar 31, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a new GitHub Actions workflow (.github/workflows/check-broken-links.yml) that runs weekly or on manual dispatch, uses Lychee to scan Markdown for broken links, and conditionally creates or updates a GitHub issue (with a dry-run option). Error handling marks the workflow failed if issue management errors occur.

Changes

Broken Link Checker Workflow

Layer / File(s) Summary
Triggers & Inputs
.github/workflows/check-broken-links.yml
New workflow header: weekly cron and workflow_dispatch with dry_run boolean input.
Permissions & Runner Hardening
.github/workflows/check-broken-links.yml
Sets contents: read and issues: write permissions; runs a hardened runner step to audit outbound calls.
Link Checking
.github/workflows/check-broken-links.yml
Adds step to run Lychee against repository Markdown with verbose, non-progress flags; treats failures as signal for issue management.
Idempotent Issue Management
.github/workflows/check-broken-links.yml
Shell script: determines manual/dry-run, builds labels/title/body, computes run URL, lists open issues with labels, updates matching issue or creates a new labeled issue; on dry-run logs results and exits without creating/updating.
Error Handling / Exit Semantics
.github/workflows/check-broken-links.yml
Catches and logs errors during GitHub API interactions and sets workflow failure if issue management errors occur.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as Runner (GitHub Actions)
    participant Lychee as Lychee CLI
    participant GitHubAPI as GitHub API
    participant Repo as Repository (Markdown)

    Note over Runner,Repo: Scheduled or manual trigger
    Runner->>Repo: checkout code
    Runner->>Lychee: run link scan on Markdown
    Lychee-->>Runner: exit code + report
    alt broken links found and not dry_run
        Runner->>GitHubAPI: list open issues with labels
        GitHubAPI-->>Runner: issues list
        alt existing issue with title
            Runner->>GitHubAPI: post comment to issue
            GitHubAPI-->>Runner: comment created
        else no existing issue
            Runner->>GitHubAPI: create new labeled issue with body
            GitHubAPI-->>Runner: issue created
        end
    else dry_run or no broken links
        Runner-->>Runner: log results (no issue changes)
    end
    alt error during issue management
        Runner->>Runner: mark workflow as failed
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

help needed: github maintainers

Suggested reviewers

  • aceppaluni
  • danielmarv
  • rbarker-dev

Poem

🐰 I hopped through files at break of day,
Scanning links that led astray,
Lychee sniffed and gave a ding,
An issue grew from what I'd bring,
Dry-run sure, but fixes play 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat: add workflow to check broken links' clearly and specifically summarizes the main change: adding a workflow for checking broken links.
Description check ✅ Passed The PR description provides context about the workflow origin, key changes, test verification, and issue reference, though it doesn't follow the exact template structure with all labeled sections.
Linked Issues check ✅ Passed The PR successfully implements the core requirement from issue #283 [#283] by adding an automated broken-link checker workflow adapted from hiero-sdk-python with weekly scheduling.
Out of Scope Changes check ✅ Passed The PR contains only the new GitHub Actions workflow file without unrelated changes. All modifications are directly scoped to implementing the broken link checker automation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Abhijeet2409 Abhijeet2409 force-pushed the fix-broken-links-workflow branch from 0c8ba51 to 748ca71 Compare March 31, 2026 11:40
Signed-off-by: Abhijeet Saharan <abhijeetsaharan2236@gmail.com>
@Abhijeet2409 Abhijeet2409 force-pushed the fix-broken-links-workflow branch from cc19b81 to 01a9f0c Compare March 31, 2026 12:02
@Abhijeet2409 Abhijeet2409 marked this pull request as ready for review March 31, 2026 12:08
@Abhijeet2409 Abhijeet2409 requested a review from a team as a code owner March 31, 2026 12:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/check-broken-links.yml (2)

27-28: Consider aligning actions/checkout version with ci.yml.

This workflow uses actions/checkout v6.0.1, while ci.yml uses v6.0.2. Aligning versions across workflows reduces maintenance overhead and ensures consistent behavior.

📦 Suggested version alignment
       - name: Checkout repository
-        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/check-broken-links.yml around lines 27 - 28, Update the
pinned actions/checkout reference in the workflow so it matches the version used
in ci.yml: replace the current uses:
actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with the same v6.0.2
tag/hash used in ci.yml to ensure consistent behavior across workflows (locate
the uses: actions/checkout line to make the change).

18-20: Consider adding concurrency control.

Unlike ci.yml, this workflow lacks concurrency control. While unlikely for a weekly cron job, concurrent runs (e.g., manual trigger during scheduled run) could cause duplicate issue creation or conflicting updates.

🔧 Add concurrency block
 permissions:
   contents: read
   issues: write

+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 jobs:
   cron-check-broken-links:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/check-broken-links.yml around lines 18 - 20, Add a GitHub
Actions concurrency block for the cron-check-broken-links job to prevent
overlapping runs: in the workflow containing the cron-check-broken-links job,
add a concurrency declaration (using a unique group name that includes the job
name and the Git ref or workflow name) and enable cancel-in-progress so a new
manual or scheduled run cancels the previous run; update the job block for
cron-check-broken-links to reference that concurrency group.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/check-broken-links.yml:
- Around line 27-28: Update the pinned actions/checkout reference in the
workflow so it matches the version used in ci.yml: replace the current uses:
actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with the same v6.0.2
tag/hash used in ci.yml to ensure consistent behavior across workflows (locate
the uses: actions/checkout line to make the change).
- Around line 18-20: Add a GitHub Actions concurrency block for the
cron-check-broken-links job to prevent overlapping runs: in the workflow
containing the cron-check-broken-links job, add a concurrency declaration (using
a unique group name that includes the job name and the Git ref or workflow name)
and enable cancel-in-progress so a new manual or scheduled run cancels the
previous run; update the job block for cron-check-broken-links to reference that
concurrency group.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f6e23bc0-18e7-4a60-aa54-c602422065b3

📥 Commits

Reviewing files that changed from the base of the PR and between 45dbf0a and 01a9f0c.

📒 Files selected for processing (1)
  • .github/workflows/check-broken-links.yml

@MonaaEid MonaaEid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @Abhijeet2409, I suggest creating a separate file for the script, for example: scripts/check-broken-links.js also, test this on your fork to see what the layout of the created issue looks like

exploreriii
exploreriii previously approved these changes Apr 1, 2026

@exploreriii exploreriii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follows the python one very nicely with a key time adjustment, and well tested!
Thank you very much

@Abhijeet2409

Copy link
Copy Markdown
Member Author

Hey @MonaaEid, appreciate the suggestion.

Since the goal was to import the workflow with minimal adjustments and the PR has already been approved, should I still go ahead and refactor this into a separate script, or keep it as is for now?

@MonaaEid

MonaaEid commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

No need to refactor this atm, nice work @Abhijeet2409

@aceppaluni

Copy link
Copy Markdown
Contributor

Is this ready for merge?

danielmarv
danielmarv previously approved these changes Apr 11, 2026

@danielmarv danielmarv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!
Thanks @Abhijeet2409

@danielmarv

Copy link
Copy Markdown
Member

cc @hiero-ledger/github-maintainers

aceppaluni
aceppaluni previously approved these changes Apr 18, 2026
Signed-off-by: Abhijeet <abhijeetsaharan2236@gmail.com>
@Abhijeet2409 Abhijeet2409 dismissed stale reviews from aceppaluni, danielmarv, and exploreriii via 0949095 May 6, 2026 05:32

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/check-broken-links.yml:
- Around line 40-103: Add a companion success-path step (run when
steps.lychee.outcome == 'success') that searches open issues with the same
targetLabels and issueTitle using github.rest.issues.listForRepo, finds the
matching issue (issues.find by title === issueTitle), and closes it by calling
github.rest.issues.update with issue_number and state: 'closed'; keep dry-run
handling consistent (check dryRun) and log actions, and reuse the existing
targetLabels and issueTitle identifiers so the same automated issue is closed
when a subsequent run passes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bebbddd2-b1c6-46ab-a50c-f06e9e9b7c1e

📥 Commits

Reviewing files that changed from the base of the PR and between 01a9f0c and 0949095.

📒 Files selected for processing (1)
  • .github/workflows/check-broken-links.yml

Comment thread .github/workflows/check-broken-links.yml
@Abhijeet2409

Copy link
Copy Markdown
Member Author

I’ve addressed the requested changes. Let me know if anything else needs to be updated.

@danielmarv

Copy link
Copy Markdown
Member

cc @rbarker-dev

@jwagantall

Copy link
Copy Markdown
Contributor

@hiero-ledger/github-maintainers , Could you please review this PR again? The changes have been addressed

@aceppaluni aceppaluni added the update branch Contributor needs to click update branch label May 22, 2026
@aceppaluni aceppaluni removed the update branch Contributor needs to click update branch label May 26, 2026
@aceppaluni

Copy link
Copy Markdown
Contributor

@hiero-ledger/github-maintainers

@aceppaluni aceppaluni added update branch Contributor needs to click update branch and removed update branch Contributor needs to click update branch labels May 31, 2026
@aceppaluni aceppaluni added update branch Contributor needs to click update branch and removed update branch Contributor needs to click update branch labels Jun 15, 2026
@aceppaluni

Copy link
Copy Markdown
Contributor

@hiero-ledger/github-maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help needed: github maintainers update branch Contributor needs to click update branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an automation to check for broken links

8 participants