Skip to content

Fix markdown relative links to use HTTP URLs in templates#40

Merged
DutchmanNL merged 3 commits intomainfrom
copilot/fix-39
Sep 19, 2025
Merged

Fix markdown relative links to use HTTP URLs in templates#40
DutchmanNL merged 3 commits intomainfrom
copilot/fix-39

Conversation

Copy link
Contributor

Copilot AI commented Sep 19, 2025

The template files contained relative markdown links to snippet files (../snippets/version-check-command.md and ../snippets/github-action-version-check.yml) that would break when these templates are used in external repositories outside of this one, since the snippets/ directory doesn't exist there.

This change converts all relative snippet references to absolute HTTP URLs pointing to the raw GitHub content:

Before:

- **Version Check**: See [version check command](../snippets/version-check-command.md)
- **GitHub Action Template**: [GitHub Action](../snippets/github-action-version-check.yml)

After:

- **Version Check**: See [version check command](https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/snippets/version-check-command.md)
- **GitHub Action Template**: [GitHub Action](https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/snippets/github-action-version-check.yml)

The fix ensures that when developers copy these templates to their own repositories (as intended), all links will continue to work correctly by pointing directly to the authoritative source content.

Additionally, added comprehensive tests (tests/test-http-links.sh) to validate the HTTP URL conversion and prevent regression of this issue in the future.

Files modified:

  • templates/initial-setup-automation.md - Fixed both version check and GitHub Action snippet references
  • templates/automated-template-update.md - Fixed version check command reference
  • tests/test-http-links.sh - New test to validate HTTP URLs and prevent regression

All URLs have been verified to return the expected content and all existing tests continue to pass.

Fixes #39.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI self-assigned this Sep 19, 2025
Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Copilot AI changed the title [WIP] md links to http Fix markdown relative links to use HTTP URLs in templates Sep 19, 2025
Copilot AI requested a review from DutchmanNL September 19, 2025 02:59
@DutchmanNL DutchmanNL marked this pull request as ready for review September 19, 2025 03:02
Copilot AI review requested due to automatic review settings September 19, 2025 03:02
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 replaces relative markdown links to snippet files in templates with absolute HTTPS URLs to raw GitHub content, ensuring links remain valid when the templates are copied into external repositories. It also adds a test suite to validate the presence of correct HTTP links and absence of relative references.

  • Convert relative snippet links to absolute raw GitHub URLs
  • Add tests to verify link correctness and optionally check URL accessibility

Reviewed Changes

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

File Description
templates/initial-setup-automation.md Updated snippet links to absolute HTTPS raw GitHub URLs
templates/automated-template-update.md Updated version check snippet link to absolute HTTPS raw GitHub URL
tests/test-http-links.sh New test verifying templates do not contain relative snippet links and do contain the expected HTTP URLs

Comment on lines +27 to +59
run_test_with_output() {
local TEST_NAME="$1"
local EXPECTED_PATTERN="$2"
local COMMAND="$3"

echo -n " Testing $TEST_NAME... "

if eval "$COMMAND" 2>/dev/null | grep -q "$EXPECTED_PATTERN"; then
echo -e "${GREEN}✅ PASS${NC}"
return 0
else
echo -e "${RED}❌ FAIL${NC}"
EXIT_CODE=1
return 1
fi
}

# Test framework helper for negative tests (commands that should fail)
run_negative_test() {
local TEST_NAME="$1"
local COMMAND="$2"

echo -n " Testing $TEST_NAME... "

if eval "$COMMAND" 2>/dev/null; then
echo -e "${RED}❌ FAIL${NC}"
EXIT_CODE=1
return 1
else
echo -e "${GREEN}✅ PASS${NC}"
return 0
fi
}
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

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

Using eval and a second grep in a pipeline is unnecessary and brittle. Simplify by invoking grep directly and checking its exit status, which also removes quoting pitfalls and command injection risk. Example:

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DutchmanNL DutchmanNL merged commit 2596631 into main Sep 19, 2025
2 checks passed
Copilot AI added a commit that referenced this pull request Sep 19, 2025
Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
DutchmanNL added a commit that referenced this pull request Sep 19, 2025
…47)

* Initial plan

* Fix README and documentation links to use HTTP URLs in line with #40

Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

md links to http

3 participants