Skip to content

Commit f05b8e0

Browse files
authored
Merge branch 'sherlock-project:master' into code-sandbox
2 parents 738df6c + d2835e5 commit f05b8e0

File tree

2 files changed

+40
-18
lines changed

2 files changed

+40
-18
lines changed

.github/workflows/validate_modified_targets.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,57 @@ jobs:
1717
- name: Checkout repository
1818
uses: actions/checkout@v5
1919
with:
20+
# Checkout the base branch but fetch all history to avoid a second fetch call
2021
ref: ${{ github.base_ref }}
21-
fetch-depth: 1
22+
fetch-depth: 0
2223

2324
- name: Set up Python
2425
uses: actions/setup-python@v6
2526
with:
26-
python-version: '3.13'
27+
python-version: "3.13"
2728

2829
- name: Install Poetry
2930
uses: abatilo/actions-poetry@v4
3031
with:
31-
poetry-version: 'latest'
32+
poetry-version: "latest"
3233

3334
- name: Install dependencies
3435
run: |
3536
poetry install --no-interaction --with dev
3637
37-
- name: Drop in place updated manifest from base
38+
- name: Prepare JSON versions for comparison
3839
run: |
39-
cp sherlock_project/resources/data.json data.json.base
40-
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr --depth=1
41-
git show pr:sherlock_project/resources/data.json > sherlock_project/resources/data.json
42-
cp sherlock_project/resources/data.json data.json.head
40+
# Fetch only the PR's branch head (single network call in this step)
41+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr
42+
43+
# Find the merge-base commit between the target branch and the PR branch
44+
MERGE_BASE=$(git merge-base origin/${{ github.base_ref }} pr)
45+
echo "Comparing PR head against merge-base commit: $MERGE_BASE"
46+
47+
# Safely extract the file from the PR's head and the merge-base commit
48+
git show pr:sherlock_project/resources/data.json > data.json.head
49+
git show $MERGE_BASE:sherlock_project/resources/data.json > data.json.base
50+
51+
# CRITICAL FIX: Overwrite the checked-out data.json with the one from the PR
52+
# This ensures that pytest runs against the new, updated file.
53+
cp data.json.head sherlock_project/resources/data.json
4354
4455
- name: Discover modified targets
4556
id: discover-modified
4657
run: |
4758
CHANGED=$(
4859
python - <<'EOF'
4960
import json
50-
with open("data.json.base") as f: base = json.load(f)
51-
with open("data.json.head") as f: head = json.load(f)
61+
import sys
62+
try:
63+
with open("data.json.base") as f: base = json.load(f)
64+
with open("data.json.head") as f: head = json.load(f)
65+
except FileNotFoundError as e:
66+
print(f"Error: Could not find {e.filename}", file=sys.stderr)
67+
sys.exit(1)
68+
except json.JSONDecodeError as e:
69+
print(f"Error: Could not decode JSON from a file - {e}", file=sys.stderr)
70+
sys.exit(1)
5271
5372
changed = []
5473
for k, v in head.items():
@@ -63,6 +82,8 @@ jobs:
6382
echo -e ">>> Changed targets: \n$(echo $CHANGED | tr ',' '\n')"
6483
echo "changed_targets=$CHANGED" >> "$GITHUB_OUTPUT"
6584
85+
# --- The rest of the steps below are unchanged ---
86+
6687
- name: Validate modified targets
6788
if: steps.discover-modified.outputs.changed_targets != ''
6889
continue-on-error: true

sherlock_project/resources/data.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@
259259
"username_claimed": "blue"
260260
},
261261
"Blitz Tactics": {
262-
"errorType": "status_code",
262+
"errorMsg": "That page doesn't exist",
263+
"errorType": "message",
263264
"url": "https://blitztactics.com/{}",
264265
"urlMain": "https://blitztactics.com/",
265266
"username_claimed": "Lance5500"
@@ -278,6 +279,7 @@
278279
"urlMain": "https://bsky.app/",
279280
"username_claimed": "mcuban"
280281
},
282+
281283
"BongaCams": {
282284
"errorType": "status_code",
283285
"isNSFW": true,
@@ -2333,6 +2335,12 @@
23332335
"urlMain": "https://discourse.wicg.io/",
23342336
"username_claimed": "stefano"
23352337
},
2338+
"Wakatime": {
2339+
"errorType": "status_code",
2340+
"url": "https://wakatime.com/@{}",
2341+
"urlMain": "https://wakatime.com/",
2342+
"username_claimed": "blue"
2343+
},
23362344
"Warrior Forum": {
23372345
"errorType": "status_code",
23382346
"url": "https://www.warriorforum.com/members/{}.html",
@@ -2877,13 +2885,6 @@
28772885
"urlMain": "https://znanylekarz.pl",
28782886
"username_claimed": "janusz-nowak"
28792887
},
2880-
"Bluesky": {
2881-
"errorType": "status_code",
2882-
"url": "https://bsky.app/profile/{}.bsky.social",
2883-
"urlProbe": "https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile?actor={}.bsky.social",
2884-
"urlMain": "https://bsky.app/",
2885-
"username_claimed": "mcuban"
2886-
},
28872888
"Platzi": {
28882889
"errorType": "status_code",
28892890
"errorCode": 404,

0 commit comments

Comments
 (0)