44 pull_request :
55 branches : [main]
66
7+ env :
8+ TARGET_REPO_URL : https://github.com/espressif/developer-portal.git
9+ TARGET_BRANCH : main
10+
711jobs :
812 check-links :
913 runs-on : ubuntu-latest
@@ -18,21 +22,25 @@ jobs:
1822 - name : Set environment variables
1923 id : set-env
2024 run : |
25+ # Add target remote and fetch its branches
26+ git remote add target ${{ env.TARGET_REPO_URL }}
27+ git fetch target ${{ env.TARGET_BRANCH }}
28+
2129 # Extract the base commit ID where the feature branch diverged from main
22- base_commit=$(git merge-base origin/main ${{ github.event.pull_request.head.ref }})
23- echo "base_commit =$base_commit" >> $GITHUB_ENV
30+ base_commit=$(git merge-base target/${{ env.TARGET_BRANCH }} ${{ github.event.pull_request.head.ref }})
31+ echo "BASE_COMMIT =$base_commit" | tee -a $GITHUB_ENV
2432
2533 # Extract the head commit ID on the feature branch
2634 head_commit=${{ github.event.pull_request.head.sha }}
27- echo "head_commit =$head_commit" >> $GITHUB_ENV
35+ echo "HEAD_COMMIT =$head_commit" | tee -a $GITHUB_ENV
2836
2937 - name : Create baseline branch by reverting feature branch changes
3038 run : |
3139 # Create a copy of the feature branch
3240 git checkout -b feature-baseline
3341
3442 # Reset the new branch to the base commit
35- git reset --hard ${{ env.base_commit }}
43+ git reset --hard ${{ env.BASE_COMMIT }}
3644
3745 - name : Dump all links from feature-baseline
3846 uses :
lycheeverse/[email protected] @@ -51,14 +59,11 @@ jobs:
5159 - name : Append links-baseline.txt to .lycheeignore
5260 run : cat links-baseline.txt >> .lycheeignore
5361
54- - name : Print .lycheeignore
55- run : cat .lycheeignore
56-
5762 - name : Dump names of files altered in PR and append hash sign to find links with anchors
5863 run : |
59- git diff --name-only --diff-filter=DM ${{ env.base_commit }} ${{ env.head_commit }} > altered-files.txt
64+ git diff --name-only --diff-filter=DM ${{ env.BASE_COMMIT }} ${{ env.HEAD_COMMIT }} > altered-files.txt
6065 sed -i 's|$|#|' altered-files.txt
61- git diff --name-status --diff-filter=R ${{ env.base_commit }} ${{ env.head_commit }} | awk '{print $2}' > renamed-files.txt
66+ git diff --name-status --diff-filter=R ${{ env.BASE_COMMIT }} ${{ env.HEAD_COMMIT }} | awk '{print $2}' > renamed-files.txt
6267 sed -i 's|$|#|' renamed-files.txt
6368
6469 - name : Print altered-files.txt
0 commit comments