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

added github workflow duplicates.yml for checking duplicate links and raising the issue if found any duplicate links #738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
43 changes: 43 additions & 0 deletions .github/workflows/duplicates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Check for Duplicate Links

on:
schedule:
- cron: '0 0 * * 0' # Runs every Sunday at midnight (UTC)

jobs:
check_duplicates:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq

- name: Check for duplicate Links
id: check_links
run: |
# Find all markdown files and extract links
links=$(grep -oh 'http[s]*://[^ ]*' **/*.md | sort | uniq -d)

if [ -n "$links" ]; then
echo "::set-output name=duplicates::$links"
else
echo "No duplicate links found."
fi

- name: Create GitHub Issue
if: ${{ steps.check_links.outputs.duplicates != '' }}
uses: peter-evans/create-issue@v2
with:
title: 'Duplicate Links Found'
body: |
The following duplicate links were found:
```
${{ steps.check_links.outputs.duplicates }}
```
labels: 'duplicate links'
token: ${{ secrets.GITHUB_TOKEN }}