From b11b289190e5bb6d8ed54f72303550c789f49666 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Sat, 12 Oct 2024 16:30:13 +0200 Subject: [PATCH 1/3] add github workflow to cargo update --- .github/workflows/dependencies.yml | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/dependencies.yml diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml new file mode 100644 index 0000000..3d9d074 --- /dev/null +++ b/.github/workflows/dependencies.yml @@ -0,0 +1,61 @@ +# Runs `cargo update` periodically. + +name: Update Dependencies + +on: + schedule: + # Run weekly + - cron: "0 0 * * SUN" + workflow_dispatch: + # Needed so we can run it manually + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: cargo-update + TITLE: "chore(deps): weekly `cargo update`" + BODY: | + Automation to keep dependencies in `Cargo.lock` current. + +
cargo update log +

+ + ```log + $cargo_update_log + ``` + +

+
+ +jobs: + update: + name: Update + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + + - name: cargo update + # Remove first line that always just says "Updating crates.io index" + run: cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log + + - name: craft commit message and PR body + id: msg + run: | + export cargo_update_log="$(cat cargo_update.log)" + + echo "commit_message<> $GITHUB_OUTPUT + printf "$TITLE\n\n$cargo_update_log\n" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + echo "body<> $GITHUB_OUTPUT + echo "$BODY" | envsubst >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + add-paths: ./Cargo.lock + commit-message: ${{ steps.msg.outputs.commit_message }} + title: ${{ env.TITLE }} + body: ${{ steps.msg.outputs.body }} + branch: ${{ env.BRANCH }} \ No newline at end of file From 36a8cabdba8e9832b611904d34a3000cfccee3b6 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Sat, 12 Oct 2024 16:34:09 +0200 Subject: [PATCH 2/3] fmt --- .github/workflows/dependencies.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 3d9d074..be76b17 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -36,7 +36,9 @@ jobs: - name: cargo update # Remove first line that always just says "Updating crates.io index" - run: cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log + run: + cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a + cargo_update.log - name: craft commit message and PR body id: msg @@ -58,4 +60,4 @@ jobs: commit-message: ${{ steps.msg.outputs.commit_message }} title: ${{ env.TITLE }} body: ${{ steps.msg.outputs.body }} - branch: ${{ env.BRANCH }} \ No newline at end of file + branch: ${{ env.BRANCH }} From c2ecb4da8572108f083311dd6ee9bc4a26ef5e36 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Sat, 12 Oct 2024 16:45:55 +0200 Subject: [PATCH 3/3] fix trunk --- .github/workflows/dependencies.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index be76b17..cc3867f 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -5,7 +5,7 @@ name: Update Dependencies on: schedule: # Run weekly - - cron: "0 0 * * SUN" + - cron: 0 0 * * SUN workflow_dispatch: # Needed so we can run it manually @@ -26,6 +26,10 @@ env:

+permissions: + checks: write + contents: write + jobs: update: name: Update @@ -36,9 +40,8 @@ jobs: - name: cargo update # Remove first line that always just says "Updating crates.io index" - run: - cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a - cargo_update.log + run: | + cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log - name: craft commit message and PR body id: msg