Skip to content

Commit c5fa9d0

Browse files
committed
Update site list to sherlockproject.xyz/sites
With these changes, the site list will be written to the sherlock-project/sherlockproject.xyz repo where the docs and everything is located. This way, we wont have to manually update the list on the website.
1 parent b80f38d commit c5fa9d0

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Update Site List
1+
name: Update Site List
22

33
# Trigger the workflow when changes are pushed to the main branch
44
# and the changes include the sherlock/resources/data.json file
55
on:
66
push:
77
branches:
8-
- master
8+
- master
99
paths:
1010
- sherlock/resources/data.json
1111

@@ -26,24 +26,21 @@ jobs:
2626
- name: Install Python
2727
uses: actions/setup-python@v5
2828
with:
29-
python-version: '3.x'
29+
python-version: '3.x'
3030

3131
# Execute the site_list.py Python script
3232
- name: Execute site-list.py
3333
run: python devel/site-list.py
3434

35-
# Commit any changes made by the script
36-
- name: Commit files
37-
run: |
38-
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
39-
git config --local user.name "github-actions[bot]"
40-
if ! git diff --exit-code; then
41-
git commit -a -m "Updated Site List"
42-
fi
43-
44-
# Push the changes to the remote repository
45-
- name: Push changes
46-
uses: ad-m/github-push-action@master
35+
- name: Pushes to another repository
36+
uses: cpina/github-action-push-to-another-repository@main
37+
env:
38+
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
39+
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
4740
with:
48-
github_token: ${{ secrets.GITHUB_TOKEN }}
49-
branch: ${{ github.ref }}
41+
source-directory: 'output'
42+
destination-github-username: 'sherlock-project'
43+
commit-message: "Updated site list"
44+
destination-repository-name: 'sherlockproject.xyz'
45+
user-email: [email protected]
46+
target-branch: master

devel/site-list.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# This module generates the listing of supported sites which can be found in
33
# sites.md. It also organizes all the sites in alphanumeric order
44
import json
5+
import os
56

67
# Read the data.json file
78
with open("sherlock/resources/data.json", "r", encoding="utf-8") as data_file:
@@ -14,13 +15,16 @@
1415
# Sort the social networks in alphanumeric order
1516
social_networks: list = sorted(social_networks.items())
1617

18+
# Make output dir where the site list will be written
19+
os.mkdir("output")
20+
1721
# Write the list of supported sites to sites.md
18-
with open("../sites.md", "w") as site_file:
19-
site_file.write(f"## List Of Supported Sites ({len(social_networks)} Sites In Total!)\n")
22+
with open("output/sites.mdx", "w") as site_file:
23+
site_file.write(f"---\ntitle: 'List of supported sites'\nsidebarTitle: 'Supported sites'\nicon: 'globe'\ndescription: 'Sherlock currently supports **400+** sites'\n---\n\n")
2024
for social_network, info in social_networks:
2125
url_main = info["urlMain"]
2226
is_nsfw = "**(NSFW)**" if info.get("isNSFW") else ""
23-
site_file.write(f"1. ![](https://www.google.com/s2/favicons?domain={url_main}) [{social_network}]({url_main}) {is_nsfw}\n")
27+
site_file.write(f"1. [{social_network}]({url_main}) {is_nsfw}\n")
2428

2529
# Overwrite the data.json file with sorted data
2630
with open("sherlock/resources/data.json", "w") as data_file:
@@ -29,3 +33,4 @@
2933
data_file.write("\n")
3034

3135
print("Finished updating supported site listing!")
36+

0 commit comments

Comments
 (0)