|
1 |
| -name: "Clean Repo" |
| 1 | + |
| 2 | +name: "clean repo - ATADocs" |
2 | 3 |
|
3 | 4 | on:
|
4 |
| - workflow_dispatch: |
5 | 5 | 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: |
7 | 8 |
|
8 | 9 | permissions:
|
9 |
| - contents: write |
10 |
| - pull-requests: write |
| 10 | + contents: read |
11 | 11 |
|
12 | 12 | jobs:
|
13 |
| - clean-defender: |
| 13 | + clean-repo: |
14 | 14 | runs-on: ubuntu-latest
|
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + pull-requests: write |
15 | 18 |
|
16 | 19 | steps:
|
17 |
| - - name: Checkout repository |
18 |
| - uses: actions/checkout@v5 |
19 |
| - with: |
20 |
| - fetch-depth: 0 |
21 | 20 |
|
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 |
26 | 22 |
|
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 |
39 | 25 | uses: dotnet/docs-tools/cleanrepo@main
|
40 | 26 | with:
|
41 | 27 | function: "FindOrphanedArticles"
|
42 |
| - docfx_directory: "." |
43 |
| - target_directory: "." |
| 28 | + docfx_directory: "ATADocs" |
| 29 | + target_directory: "ATADocs" |
44 | 30 | url_base_path: "/dotnet"
|
45 | 31 |
|
46 |
| - - name: Clean orphaned images |
| 32 | + # Find orphaned images |
| 33 | + - name: Clean repo - orphaned images |
47 | 34 | uses: dotnet/docs-tools/cleanrepo@main
|
48 | 35 | with:
|
49 | 36 | function: "FindOrphanedImages"
|
50 |
| - docfx_directory: "." |
51 |
| - target_directory: "." |
| 37 | + docfx_directory: "ATADocs" |
| 38 | + target_directory: "ATADocs" |
52 | 39 | url_base_path: "/dotnet"
|
53 | 40 |
|
54 |
| - - name: Clean orphaned includes |
| 41 | + # Find orphaned includes |
| 42 | + - name: Clean repo - orphaned includes |
55 | 43 | uses: dotnet/docs-tools/cleanrepo@main
|
56 | 44 | with:
|
57 | 45 | function: "FindOrphanedIncludes"
|
58 |
| - docfx_directory: "." |
59 |
| - target_directory: "." |
| 46 | + docfx_directory: "ATADocs" |
| 47 | + target_directory: "ATADocs" |
60 | 48 | url_base_path: "/dotnet"
|
61 | 49 |
|
62 |
| - - name: Clean orphaned snippets |
| 50 | + # Find orphaned snippets |
| 51 | + - name: Clean repo - orphaned snippets |
63 | 52 | uses: dotnet/docs-tools/cleanrepo@main
|
64 | 53 | with:
|
65 | 54 | function: "FindOrphanedSnippets"
|
66 |
| - docfx_directory: "." |
67 |
| - target_directory: "." |
| 55 | + docfx_directory: "ATADocs" |
| 56 | + target_directory: "ATADocs" |
68 | 57 | url_base_path: "/dotnet"
|
69 | 58 |
|
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 |
77 | 61 | uses: dotnet/actions-create-pull-request@v4
|
78 | 62 | 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