Skip to content

Commit e514581

Browse files
committed
ci: split link checking into multiple jobs
1 parent f56a671 commit e514581

File tree

2 files changed

+43
-16
lines changed

2 files changed

+43
-16
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Check links in diffs
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
check-links:
9+
strategy:
10+
matrix:
11+
include:
12+
- glob_pattern: "--exclude-path content/blog/ ./content/ README.md"
13+
job_name: "non-blog"
14+
- glob_pattern: "./content/blog/[0-9a-f]*/"
15+
job_name: "blog_0-9a-f"
16+
- glob_pattern: "./content/blog/[g-z]*/"
17+
job_name: "blog_g-z"
18+
fail-fast: false
19+
name: ${{ matrix.job_name }}
20+
uses: ./.github/workflows/pr-check-links-worker.yml
21+
with:
22+
glob_pattern: ${{ matrix.glob_pattern }}
23+
target_repo_url: "https://github.com/espressif/developer-portal.git"
24+
target_branch: "main"

.github/workflows/pr-check-links.yml renamed to .github/workflows/pr-check-links-worker.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
name: Check links in diffs
1+
name: Check links worker
22

33
on:
4-
pull_request:
5-
branches: [main]
6-
7-
env:
8-
TARGET_REPO_URL: https://github.com/espressif/developer-portal.git
9-
TARGET_BRANCH: main
4+
workflow_call:
5+
inputs:
6+
glob_pattern:
7+
required: true
8+
type: string
9+
target_repo_url:
10+
required: true
11+
type: string
12+
target_branch:
13+
required: true
14+
type: string
1015

1116
jobs:
1217
check-links:
@@ -23,11 +28,11 @@ jobs:
2328
id: set-env
2429
run: |
2530
# Add target remote and fetch its branches
26-
git remote add target ${{ env.TARGET_REPO_URL }}
27-
git fetch target ${{ env.TARGET_BRANCH }}
31+
git remote add target ${{ inputs.target_repo_url }}
32+
git fetch target ${{ inputs.target_branch }}
2833
2934
# Extract the base commit ID where the feature branch diverged from main
30-
base_commit=$(git merge-base target/${{ env.TARGET_BRANCH }} ${{ github.event.pull_request.head.ref }})
35+
base_commit=$(git merge-base target/${{ inputs.target_branch }} ${{ github.event.pull_request.head.ref }})
3136
echo "BASE_COMMIT=$base_commit" | tee -a $GITHUB_ENV
3237
3338
# Extract the head commit ID on the feature branch
@@ -48,9 +53,8 @@ jobs:
4853
args: |
4954
--dump
5055
--include-fragments
51-
--exclude-path ./themes/
52-
--exclude-path ./layouts/
53-
.
56+
--glob-ignore-case
57+
${{ inputs.glob_pattern }}
5458
output: links-baseline.txt
5559

5660
- name: Check out feature branch
@@ -93,9 +97,8 @@ jobs:
9397
args: |
9498
--no-progress
9599
--include-fragments
96-
--exclude-path ./themes/
97-
--exclude-path ./layouts/
98-
.
100+
--glob-ignore-case
101+
${{ inputs.glob_pattern }}
99102
fail: true # Fail action if broken links are found
100103

101104
- name: Suggestions

0 commit comments

Comments
 (0)