-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new scheduled workflow machete.yml
- Loading branch information
Showing
2 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: cleanup | ||
|
||
on: | ||
schedule: | ||
# Runs every Monday at 10:00 AM CET (which is 9:00 AM UTC) | ||
- cron: '0 9 * * 1' | ||
workflow_dispatch: # Allow manual triggering of the workflow | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Install cargo-machete | ||
run: cargo install cargo-machete | ||
|
||
- name: Find Unused Dependencies | ||
run: cargo machete --with-metadata | ||
|
||
- name: Fix Unused Dependencies | ||
run: cargo machete --fix | ||
|
||
- name: Create a new branch for the changes | ||
id: create_branch | ||
run: | | ||
# Generate a unique branch name based on the current date and time | ||
BRANCH_NAME="cleanup-$(date +%Y%m%d%H%M%S)" | ||
git checkout -b "$BRANCH_NAME" | ||
echo "Created new branch $BRANCH_NAME" | ||
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV # Set output for later steps | ||
- name: Commit Changes | ||
run: | | ||
git config --global user.name "github-actions" | ||
git config --global user.email "[email protected]" | ||
git add . | ||
git commit -m "Fix unused dependencies using cargo machete" | ||
git push --set-upstream origin $BRANCH_NAME | ||
- name: Create a Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
base: main # The branch to merge the changes into | ||
head: ${{ env.branch_name }} # Use the branch name from the previous step | ||
title: "Fix unused dependencies" | ||
body: "This PR removes unused dependencies from the project." | ||
draft: false |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.