Skip to content

Commit 9810ed0

Browse files
BACK TO ORIGINAL VERSION OF CLEAN REPO- ATADOCS THAT ACTUALLY WORKED
1 parent 020e255 commit 9810ed0

File tree

1 file changed

+32
-66
lines changed

1 file changed

+32
-66
lines changed

.github/workflows/cleanrepo.yml

Lines changed: 32 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,66 @@
1-
name: "Clean Repo"
1+
2+
name: "clean repo - ATADocs"
23

34
on:
4-
workflow_dispatch:
55
schedule:
6-
- cron: "0 1 1 * *" # Monthly at 01:00 on the 1st
6+
- cron: "0 1 1 * *" # Runs at 01:00, on day 1 of the month
7+
workflow_dispatch:
78

89
permissions:
9-
contents: write
10-
pull-requests: write
10+
contents: read
1111

1212
jobs:
13-
clean-defender:
13+
clean-repo:
1414
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
1518

1619
steps:
17-
- name: Checkout repository
18-
uses: actions/checkout@v5
19-
with:
20-
fetch-depth: 0
2120

22-
- name: Set up Git config
23-
run: |
24-
git config user.name "github-actions[bot]"
25-
git config user.email "github-actions[bot]@users.noreply.github.com"
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2622

27-
- name: Create and switch to new branch
28-
id: create_branch
29-
run: |
30-
TIMESTAMP=$(date +'%Y%m%d-%H%M')
31-
BRANCH_NAME="cleanrepo-defender-$TIMESTAMP"
32-
git checkout main || git checkout -b main
33-
git pull origin main
34-
git checkout -b "$BRANCH_NAME"
35-
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
36-
echo "timestamp=$TIMESTAMP" >> $GITHUB_OUTPUT
37-
38-
- name: Clean orphaned articles
23+
# Find orphaned articles
24+
- name: Clean repo - orphaned articles
3925
uses: dotnet/docs-tools/cleanrepo@main
4026
with:
4127
function: "FindOrphanedArticles"
42-
docfx_directory: "."
43-
target_directory: "."
28+
docfx_directory: "ATADocs"
29+
target_directory: "ATADocs"
4430
url_base_path: "/dotnet"
4531

46-
- name: Clean orphaned images
32+
# Find orphaned images
33+
- name: Clean repo - orphaned images
4734
uses: dotnet/docs-tools/cleanrepo@main
4835
with:
4936
function: "FindOrphanedImages"
50-
docfx_directory: "."
51-
target_directory: "."
37+
docfx_directory: "ATADocs"
38+
target_directory: "ATADocs"
5239
url_base_path: "/dotnet"
5340

54-
- name: Clean orphaned includes
41+
# Find orphaned includes
42+
- name: Clean repo - orphaned includes
5543
uses: dotnet/docs-tools/cleanrepo@main
5644
with:
5745
function: "FindOrphanedIncludes"
58-
docfx_directory: "."
59-
target_directory: "."
46+
docfx_directory: "ATADocs"
47+
target_directory: "ATADocs"
6048
url_base_path: "/dotnet"
6149

62-
- name: Clean orphaned snippets
50+
# Find orphaned snippets
51+
- name: Clean repo - orphaned snippets
6352
uses: dotnet/docs-tools/cleanrepo@main
6453
with:
6554
function: "FindOrphanedSnippets"
66-
docfx_directory: "."
67-
target_directory: "."
55+
docfx_directory: "ATADocs"
56+
target_directory: "ATADocs"
6857
url_base_path: "/dotnet"
6958

70-
- name: Commit and push changes
71-
run: |
72-
git add .
73-
git commit -m "Clean Repo: Automated cleanup for defender folders"
74-
git push origin ${{ steps.create_branch.outputs.branch_name }}
75-
76-
- name: Create pull request
59+
# Create the PR for the work done by the "clean repo" tool
60+
- name: create-pull-request
7761
uses: dotnet/actions-create-pull-request@v4
7862
with:
79-
branch: ${{ steps.create_branch.outputs.branch_name }}
80-
title: "Clean Repo Defender: Sep 2025 (${{ steps.create_branch.outputs.timestamp }})"
81-
commit-message: "Automated cleanup for defender folders"
82-
body: |
83-
This PR was generated by the Clean Repo GitHub Action.
84-
It includes automated cleanup of:
85-
- Orphaned articles
86-
- Orphaned images
87-
- Orphaned includes
88-
- Orphaned snippets
89-
90-
Target folders:
91-
- defender
92-
- defender-xdr
93-
- defender-for-iot
94-
- defender-business
95-
- defender-endpoint
96-
- defender-for-cloud
97-
- defender-office-365
98-
- defender-vulnerability-management
99-
100-
Please review before merging.
63+
branch: cleanrepo-orphaned-articles
64+
title: "Monthly chores: Delete orphaned articles"
65+
commit-message: "Bot 🤖 generated CleanRepo tool run"
66+
body: "Find and delete orphaned articles. Contributes to #..."

0 commit comments

Comments
 (0)