Skip to content

Commit

Permalink
Merge pull request #4 from rednafi/dev
Browse files Browse the repository at this point in the history
Add --guard parameter and explicitly list filtered repositories
  • Loading branch information
rednafi committed Mar 18, 2024
2 parents de7f854 + 9447b01 commit 56dd91f
Show file tree
Hide file tree
Showing 3 changed files with 406 additions and 119 deletions.
45 changes: 40 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ Remove unused GitHub forks
Usage of fork-sweeper:
-delete
Delete forked repos
-guard value
List of repos to protect from deletion (fuzzy match name)
-max-page int
Maximum number of pages to fetch (default 100)
-older-than-days int
Fetch forked repos older than this number of days (default 60)
Fetch forked repos modified more than n days ago (default 60)
-owner string
GitHub repo owner (required)
-per-page int
Expand All @@ -65,11 +67,25 @@ Remove unused GitHub forks
Print version
```

- List forked repos older than `n` days. By default, it'll fetch all repositories that
were forked at least 60 days ago.
- List forked repos older than `n` days. By default, it'll fetch all forked repositories
that were modified at least 60 days ago. The following command lists all forked
repositories.
```sh
fork-sweeper --owner rednafi --token $GITHUB_TOKEN --older-than-days 60
fork-sweeper --owner rednafi --token $GITHUB_TOKEN --older-than-days 0
```
This returns:
```txt
Fetching forked repositories for rednafi...
Guarded forked repos [won't be deleted]:

Unguarded forked repos [will be deleted]:
- https://github.com/rednafi/cpython
- https://github.com/rednafi/dysconfig
- https://github.com/rednafi/pydantic
```
- The CLI won't delete any repository unless you explicitly tell it to do so with the
Expand All @@ -79,7 +95,26 @@ Remove unused GitHub forks
fork-sweeper --owner rednafi --token $GITHUB_TOKEN --delete
```
- By default, the CLI will fetch 100 pages of forked repositories with 100 entries in each
- You can explicitly protect some repositories from deletion with the `--guard` parameter:
```sh
fork-sweeper --owner "rednafi" --token $GITHUB_TOKEN --older-than-days 0 --guard 'py'
```
This prints:
```txt
Fetching forked repositories for rednafi...
Guarded forked repos [won't be deleted]:
- https://github.com/rednafi/cpython
- https://github.com/rednafi/pydantic
Unguarded forked repos [will be deleted]:
- https://github.com/rednafi/dysconfig
```

- By default, the CLI will fetch 100 pages of forked repositories with 100 entries on each
page. If you need more, you can set the page number as follows:

```sh
Expand Down
Loading

0 comments on commit 56dd91f

Please sign in to comment.