Update .gitea/actions/test-links/action.yml
This commit is contained in:
@@ -1,11 +1,18 @@
|
|||||||
name: "Check Links"
|
name: "Check Links"
|
||||||
description: "Check all links in markdown files for validity"
|
description: "Check all links in markdown files for validity"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
user_repository:
|
||||||
|
description: "Repository path in format owner/repo"
|
||||||
|
required: true
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Check all links in markdown files
|
- name: Check all links in markdown files
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
USER_REPO: ${{ inputs.user_repository }}
|
||||||
run: |
|
run: |
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@@ -19,6 +26,11 @@ runs:
|
|||||||
echo "Found $total_files markdown files to check"
|
echo "Found $total_files markdown files to check"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# Get repository info from environment variable
|
||||||
|
REPO_OWNER="${USER_REPO%/*}"
|
||||||
|
REPO_NAME="${USER_REPO#*/}"
|
||||||
|
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
|
||||||
|
|
||||||
has_errors=0
|
has_errors=0
|
||||||
file_index=1
|
file_index=1
|
||||||
|
|
||||||
@@ -65,13 +77,6 @@ runs:
|
|||||||
# Determine link category and validation status
|
# Determine link category and validation status
|
||||||
status="✓"
|
status="✓"
|
||||||
|
|
||||||
# Get repository info from git remote (once)
|
|
||||||
if [ -z "$REPO_OWNER" ]; then
|
|
||||||
REPO_OWNER=$(git config --get remote.origin.url | sed -n 's|.*[:/]\([^/]*\)/[^/]*\.git|\1|p' || echo "")
|
|
||||||
REPO_NAME=$(git config --get remote.origin.url | sed -n 's|.*[:/][^/]*/\([^/]*\)\.git|\1|p' || echo "")
|
|
||||||
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if it's an external URL
|
# Check if it's an external URL
|
||||||
if [[ "$decoded_link" =~ ^https?:// ]]; then
|
if [[ "$decoded_link" =~ ^https?:// ]]; then
|
||||||
# Replace git.sulej.net with internal gitea URL for checking
|
# Replace git.sulej.net with internal gitea URL for checking
|
||||||
|
|||||||
Reference in New Issue
Block a user