Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hyperlinks and paths validation. #148

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f562adf
Update .github/workflows/pr-path-detection.yml
ZePan110 Sep 19, 2024
3f231e4
Update .github/workflows/pr-path-detection.yml
ZePan110 Sep 19, 2024
2c2f2fa
Update .github/workflows/pr-path-detection.yml
ZePan110 Sep 19, 2024
1f9e9e4
Add hyperlinks and paths validation.
ZePan110 Sep 19, 2024
91f4be4
test
ZePan110 Sep 19, 2024
15c6aec
test
ZePan110 Sep 19, 2024
9af6b74
Set IFS to newlines only.
ZePan110 Sep 19, 2024
ef6b6d2
Fix path error.
ZePan110 Sep 19, 2024
fde2674
Excluded mailboxes.
ZePan110 Sep 19, 2024
5af3c37
Fix path error
ZePan110 Sep 19, 2024
1a013db
Exclude linkedin links and video link verification.
ZePan110 Sep 19, 2024
a44423d
Merge branch 'zepan/dev' of https://github.com/opea-project/docs into…
ZePan110 Sep 19, 2024
2d67789
Change output.
ZePan110 Sep 19, 2024
35d25a7
Remove test output
ZePan110 Sep 19, 2024
35974b7
Update .github/workflows/pr-path-detection.yml
ZePan110 Sep 19, 2024
88e10e0
Add status code output
ZePan110 Sep 20, 2024
e97876f
test.
ZePan110 Sep 20, 2024
c31e3ab
test
ZePan110 Sep 20, 2024
318ad60
Add retry for occasional failures
ZePan110 Sep 20, 2024
5b09558
Change output
ZePan110 Sep 20, 2024
7bfbdcf
Increase the number of retries
ZePan110 Sep 20, 2024
9d9959f
delay
ZePan110 Sep 20, 2024
7e2f164
Clean up code.
ZePan110 Sep 20, 2024
45d71e5
doc: fix link to deploy options in get started (#173)
dbkinder Sep 24, 2024
b5a32a0
doc: update doc guidelines and building content
dbkinder Sep 25, 2024
3cca01e
doc: remove test directory (#176)
dbkinder Sep 25, 2024
49438ef
Add hyperlinks and paths validation.
ZePan110 Sep 19, 2024
a2ee08c
test
ZePan110 Sep 19, 2024
6382f31
test
ZePan110 Sep 19, 2024
194ca18
Set IFS to newlines only.
ZePan110 Sep 19, 2024
8882703
Fix path error.
ZePan110 Sep 19, 2024
b7fc9dc
Excluded mailboxes.
ZePan110 Sep 19, 2024
d2c1d08
Fix path error
ZePan110 Sep 19, 2024
c6d3b35
Exclude linkedin links and video link verification.
ZePan110 Sep 19, 2024
8a464d6
Update .github/workflows/pr-path-detection.yml
ZePan110 Sep 19, 2024
b2d6ac0
Update .github/workflows/pr-path-detection.yml
ZePan110 Sep 19, 2024
3da3800
Update .github/workflows/pr-path-detection.yml
ZePan110 Sep 19, 2024
ecdcb52
Change output.
ZePan110 Sep 19, 2024
0b7fcbb
Remove test output
ZePan110 Sep 19, 2024
3c692ec
Update .github/workflows/pr-path-detection.yml
ZePan110 Sep 19, 2024
94daca0
Add status code output
ZePan110 Sep 20, 2024
ea54efc
test.
ZePan110 Sep 20, 2024
bf9632e
test
ZePan110 Sep 20, 2024
a341932
Add retry for occasional failures
ZePan110 Sep 20, 2024
45087c4
Change output
ZePan110 Sep 20, 2024
2965a14
Increase the number of retries
ZePan110 Sep 20, 2024
eda586d
delay
ZePan110 Sep 20, 2024
c9fd8d9
Clean up code.
ZePan110 Sep 20, 2024
c2c7404
Merge branch 'zepan/dev' of https://github.com/opea-project/docs into…
ZePan110 Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions .github/workflows/pr-path-detection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

name: Check Paths and Hyperlinks

on:
pull_request:
branches: [main]
types: [opened, reopened, ready_for_review, synchronize]

jobs:
check-the-validity-of-hyperlinks-in-README:
runs-on: ubuntu-latest
steps:
- name: Clean Up Working Directory
run: sudo rm -rf ${{github.workspace}}/*

- name: Checkout Repo docs
uses: actions/checkout@v4

- name: Check the Validity of Hyperlinks
# "https://intel.sharepoint.com/:v:/s/mlconsultingandsupport/EZa7vjON10ZCpMvE7U-SPMwBRXbVHqe1Ybsa-fmnXayNUA?e=f6FPsl"
ZePan110 marked this conversation as resolved.
Show resolved Hide resolved
# "https://intel.sharepoint.com/:v:/s/mlconsultingandsupport/ESMIcBseFTdIuqkoB7TZy6ABfwR9CkfV49TvTa1X_Jihkg?e=zMH7O7"
run: |
cd ${{github.workspace}}
fail="FALSE"
url_lines=$(grep -Eo '\]\(http[s]?://[^)]+\)' --include='*.md' -r .|grep -Ev 'linkedin')
ZePan110 marked this conversation as resolved.
Show resolved Hide resolved
if [ -n "$url_lines" ]; then
for url_line in $url_lines; do
url=$(echo "$url_line"|cut -d '(' -f2 | cut -d ')' -f1|sed 's/\.git$//')
path=$(echo "$url_line"|cut -d':' -f1 | cut -d'/' -f2-)
if [[ "https://intel.sharepoint.com/:v:/s/mlconsultingandsupport/EZa7vjON10ZCpMvE7U-SPMwBRXbVHqe1Ybsa-fmnXayNUA?e=f6FPsl" == "$url" || "https://intel.sharepoint.com/:v:/s/mlconsultingandsupport/ESMIcBseFTdIuqkoB7TZy6ABfwR9CkfV49TvTa1X_Jihkg?e=zMH7O7" == "$url" ]]; then
ZePan110 marked this conversation as resolved.
Show resolved Hide resolved
echo "Link "$url" from ${{github.workspace}}/$path need to be verified by a real person."
else
response=$(curl -L -s -o /dev/null -w "%{http_code}" "$url")
if [ "$response" -ne 200 ]; then
echo "**********Validation failed, try again**********"
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url")
if [ "$response_retry" -eq 200 ]; then
echo "*****Retry successful*****"
else
echo "Invalid link from ${{github.workspace}}/$path: $url status code: $response_retry"
fail="TRUE"
fi
fi
fi
done
fi

if [[ "$fail" == "TRUE" ]]; then
exit 1
else
echo "All hyperlinks are valid."
fi
shell: bash

check-the-validity-of-relative-path:
runs-on: ubuntu-latest
steps:
- name: Clean up Working Directory
run: sudo rm -rf ${{github.workspace}}/*

- name: Checkout Repo docs
uses: actions/checkout@v4

- name: Checking Relative Path Validity
run: |
cd ${{github.workspace}}
fail="FALSE"
repo_name=${{ github.event.pull_request.head.repo.full_name }}
if [ "$(echo "$repo_name"|cut -d'/' -f1)" != "opea-project" ]; then
owner=$(echo "${{ github.event.pull_request.head.repo.full_name }}" |cut -d'/' -f1)
branch="https://github.com/$owner/docs/tree/${{ github.event.pull_request.head.ref }}"
else
branch="https://github.com/opea-project/docs/blob/${{ github.event.pull_request.head.ref }}"
fi
link_head="https://github.com/opea-project/docs/blob/main"
IFS=$'\n'
png_lines=$(grep -Eo '\]\([^)]+\)' --include='*.md' -r .|grep -Ev 'http'|grep -Ev 'mailto')
if [ -n "$png_lines" ]; then
for png_line in $png_lines; do
refer_path=$(echo "$png_line"|cut -d':' -f1 | cut -d'/' -f2-)
png_path=$(echo "$png_line"|cut -d '(' -f2 | cut -d ')' -f1)
if [[ "${png_path:0:1}" == "/" ]]; then
check_path=${{github.workspace}}$png_path
elif [[ "${png_path:0:1}" == "#" ]]; then
check_path=${{github.workspace}}/$refer_path$png_path
else
check_path=${{github.workspace}}/$(dirname "$refer_path")/$png_path
fi
real_path=$(realpath $check_path)
if [ $? -ne 0 ]; then
echo "Path $png_path in file ${{github.workspace}}/$refer_path does not exist"
ZePan110 marked this conversation as resolved.
Show resolved Hide resolved
fail="TRUE"
else
url=$link_head$(echo "$real_path" | sed 's|.*/docs||')
response=$(curl -I -L -s -o /dev/null -w "%{http_code}" "$url")
if [ "$response" -ne 200 ]; then
echo "**********Validation failed, try again**********"
chensuyue marked this conversation as resolved.
Show resolved Hide resolved
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url")
if [ "$response_retry" -eq 200 ]; then
echo "*****Retry successful*****"
else
echo "Retry failed. Check branch ${{ github.event.pull_request.head.ref }}"
url_dev=$branch$(echo "$real_path" | sed 's|.*/docs||')
response=$(curl -I -L -s -o /dev/null -w "%{http_code}" "$url_dev")
if [ "$response" -ne 200 ]; then
echo "**********Validation failed, try again**********"
ZePan110 marked this conversation as resolved.
Show resolved Hide resolved
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url_dev")
if [ "$response_retry" -eq 200 ]; then
echo "*****Retry successful*****"
else
echo "Invalid path from ${{github.workspace}}/$refer_path: $png_path"
ZePan110 marked this conversation as resolved.
Show resolved Hide resolved
echo "$png_line"
fail="TRUE"
fi
else
echo "Check branch ${{ github.event.pull_request.head.ref }} successfully."
fi
fi
fi
fi
done
fi
IFS=$OLDIFS
if [[ "$fail" == "TRUE" ]]; then
exit 1
else
echo "All relative links valid."
fi
shell: bash
2 changes: 1 addition & 1 deletion community/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ The OPEA projects use GitHub Action for CI test.
- End to End Test, the PR must pass all end to end tests.

#### Pull Request Review
You can add reviewers from [the code owners list](../codeowner.md) to your PR.
You can add reviewers from [the code owners list](./codeowner.md) to your PR.

## Support

Expand Down
4 changes: 2 additions & 2 deletions community/rfcs/24-05-16-OPEA-001-Overall-Design.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This RFC is used to present the OPEA overall design philosophy, including overal

The proposed overall architecture is

![OPEA Architecture](opea_architecture.png "OPEA Architecture")
![OPEA Architecture](opea_architecture.png)
ZePan110 marked this conversation as resolved.
Show resolved Hide resolved

1. GenAIComps

Expand All @@ -58,7 +58,7 @@ The proposed overall architecture is

The proposed OPEA workflow is

![OPEA Workflow](opea_workflow.png "OPEA Workflow")
![OPEA Workflow](opea_workflow.png)
ZePan110 marked this conversation as resolved.
Show resolved Hide resolved

1. Microservice

Expand Down
Loading