Skip to content

Commit e064c84

Browse files
authored
Update CleanRepo workflows (#43272)
1 parent f006d6a commit e064c84

File tree

7 files changed

+264
-17
lines changed

7 files changed

+264
-17
lines changed

.github/workflows/clean-repo.yml renamed to .github/workflows/orphaned-articles.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "clean repo"
1+
name: "clean repo - articles"
22

33
on:
44
schedule:
@@ -26,29 +26,18 @@ jobs:
2626
# Call clean repo
2727
- name: Clean repo
2828
id: clean-repo-step
29-
uses: dotnet/docs-tools/cleanrepo@2a815a6c0976e888a49264f513dc230008b4a1f2
29+
uses: dotnet/docs-tools/cleanrepo@1c13adc87741beab84bb6e286d17b3b95ce687d8
3030
with:
31+
function: 'FindOrphanedArticles'
3132
docfx_directory: '.'
32-
articles_directory: 'docs'
33-
media_directory: 'docs'
34-
snippets_directory: '.' # This includes the ./samples and ./docs directories, which both contain snippets.
35-
includes_directory: 'includes'
33+
target_directory: 'docs'
3634
url_base_path: '/dotnet'
37-
delete: true
38-
orphaned_articles: true
39-
orphaned_images: true
40-
catalog_images: false
41-
orphaned_snippets: true
42-
orphaned_includes: true
43-
replace_redirects: true
44-
relative_links: true
45-
remove_hops: true
4635

4736
# Create the PR for the work done by the "clean repo" tool
4837
- name: create-pull-request
4938
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
5039
with:
5140
branch: create-cleanrepo-pull-request/patch
52-
title: "Monthly chores: Automated repo cleanup"
41+
title: "Monthly chores: Delete orphaned articles"
5342
commit-message: 'Bot 🤖 generated CleanRepo tool run'
54-
body: "Find and delete orphaned articles, images, snippets, and include files. Remove redirection hops, update redirected links in articles, and replace site-relative links with file-relative links. Contributes to #..."
43+
body: "Find and delete orphaned articles. Contributes to #..."

.github/workflows/orphaned-images.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "clean repo - images"
2+
3+
on:
4+
schedule:
5+
- cron: "0 1 1 * *" # Runs at 01:00, on day 1 of the month
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
clean-repo:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
# Call clean repo
27+
- name: Clean repo
28+
id: clean-repo-step
29+
uses: dotnet/docs-tools/cleanrepo@1c13adc87741beab84bb6e286d17b3b95ce687d8
30+
with:
31+
function: 'FindOrphanedImages'
32+
docfx_directory: '.'
33+
target_directory: 'docs'
34+
url_base_path: '/dotnet'
35+
36+
# Create the PR for the work done by the "clean repo" tool
37+
- name: create-pull-request
38+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
39+
with:
40+
branch: create-cleanrepo-pull-request/patch
41+
title: "Monthly chores: Delete orphaned images"
42+
commit-message: 'Bot 🤖 generated CleanRepo tool run'
43+
body: "Find and delete orphaned images. Contributes to #..."
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "clean repo - includes"
2+
3+
on:
4+
schedule:
5+
- cron: "0 1 1 * *" # Runs at 01:00, on day 1 of the month
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
clean-repo:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
# Call clean repo
27+
- name: Clean repo
28+
id: clean-repo-step
29+
uses: dotnet/docs-tools/cleanrepo@1c13adc87741beab84bb6e286d17b3b95ce687d8
30+
with:
31+
function: 'FindOrphanedIncludes'
32+
docfx_directory: '.'
33+
target_directory: '.'
34+
url_base_path: '/dotnet'
35+
36+
# Create the PR for the work done by the "clean repo" tool
37+
- name: create-pull-request
38+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
39+
with:
40+
branch: create-cleanrepo-pull-request/patch
41+
title: "Monthly chores: Delete orphaned include files"
42+
commit-message: 'Bot 🤖 generated CleanRepo tool run'
43+
body: "Find and delete orphaned include files. Contributes to #..."
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "clean repo - snippets"
2+
3+
on:
4+
schedule:
5+
- cron: "0 1 1 * *" # Runs at 01:00, on day 1 of the month
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
clean-repo:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
# Call clean repo
27+
- name: Clean repo
28+
id: clean-repo-step
29+
uses: dotnet/docs-tools/cleanrepo@1c13adc87741beab84bb6e286d17b3b95ce687d8
30+
with:
31+
function: 'FindOrphanedSnippets'
32+
docfx_directory: '.'
33+
target_directory: 'docs'
34+
url_base_path: '/dotnet'
35+
36+
# Create the PR for the work done by the "clean repo" tool
37+
- name: create-pull-request
38+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
39+
with:
40+
branch: create-cleanrepo-pull-request/patch
41+
title: "Monthly chores: Delete orphaned snippets"
42+
commit-message: 'Bot 🤖 generated CleanRepo tool run'
43+
body: "Find and delete orphaned snippets. Contributes to #..."

.github/workflows/redirect-hops.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "clean repo - redirect hops"
2+
3+
on:
4+
schedule:
5+
- cron: "0 1 1 * *" # Runs at 01:00, on day 1 of the month
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
clean-repo:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
# Call clean repo
27+
- name: Clean repo
28+
id: clean-repo-step
29+
uses: dotnet/docs-tools/cleanrepo@1c13adc87741beab84bb6e286d17b3b95ce687d8
30+
with:
31+
function: 'RemoveRedirectHops'
32+
docfx_directory: '.'
33+
target_directory: 'docs'
34+
url_base_path: '/dotnet'
35+
36+
# Create the PR for the work done by the "clean repo" tool
37+
- name: create-pull-request
38+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
39+
with:
40+
branch: create-cleanrepo-pull-request/patch
41+
title: "Monthly chores: Remove redirect hops"
42+
commit-message: 'Bot 🤖 generated CleanRepo tool run'
43+
body: "Remove redirect hops, for example, if a -> b and b -> c, replace a -> b with a -> c. Contributes to #..."

.github/workflows/relative-links.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "clean repo - relative links"
2+
3+
on:
4+
schedule:
5+
- cron: "0 1 1 * *" # Runs at 01:00, on day 1 of the month
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
clean-repo:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
# Call clean repo
27+
- name: Clean repo
28+
id: clean-repo-step
29+
uses: dotnet/docs-tools/cleanrepo@1c13adc87741beab84bb6e286d17b3b95ce687d8
30+
with:
31+
function: 'ReplaceWithRelativeLinks'
32+
docfx_directory: '.'
33+
target_directory: 'docs'
34+
url_base_path: '/dotnet'
35+
36+
# Create the PR for the work done by the "clean repo" tool
37+
- name: create-pull-request
38+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
39+
with:
40+
branch: create-cleanrepo-pull-request/patch
41+
title: "Monthly chores: Use relative links"
42+
commit-message: 'Bot 🤖 generated CleanRepo tool run'
43+
body: "Find and replace absolute links with relative links. Contributes to #..."
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "clean repo - replace redirects"
2+
3+
on:
4+
schedule:
5+
- cron: "0 1 1 * *" # Runs at 01:00, on day 1 of the month
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
clean-repo:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
# Call clean repo
27+
- name: Clean repo
28+
id: clean-repo-step
29+
uses: dotnet/docs-tools/cleanrepo@1c13adc87741beab84bb6e286d17b3b95ce687d8
30+
with:
31+
function: 'ReplaceRedirectTargets'
32+
docfx_directory: '.'
33+
target_directory: 'docs'
34+
url_base_path: '/dotnet'
35+
36+
# Create the PR for the work done by the "clean repo" tool
37+
- name: create-pull-request
38+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
39+
with:
40+
branch: create-cleanrepo-pull-request/patch
41+
title: "Monthly chores: Replace redirect targets"
42+
commit-message: 'Bot 🤖 generated CleanRepo tool run'
43+
body: "Replace redirected links with target URL. Contributes to #..."

0 commit comments

Comments
 (0)