From 382ed69475974d85caf45be321d798d37a31825b Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Wed, 23 Oct 2024 09:00:09 +0200 Subject: [PATCH 1/3] add cargo update dependencies workflow --- .github/workflows/dependencies.yml | 75 ++++++++++++++++++++++++++++++ 1 file changed, 75 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 00000000..09f67d9d --- /dev/null +++ b/.github/workflows/dependencies.yml @@ -0,0 +1,75 @@ +# Runs `cargo update` periodically. + +name: Update Dependencies + +on: + schedule: + # Run weekly + - cron: 0 0 * * MON + 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 + ``` + +

+
+ +permissions: + checks: write + contents: write + pull-requests: write + +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 + + - uses: actions/create-github-app-token@v1 + id: github_token + with: + app-id: ${{ secrets.KAKAROT_BOT_APP_ID }} + private-key: ${{ secrets.KAKAROT_BOT_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ steps.github_token.outputs.token }} + 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 e841495000f4bf920b818274318aa3f7fee589e3 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Wed, 23 Oct 2024 14:14:02 +0200 Subject: [PATCH 2/3] fmt --- .github/workflows/dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 09f67d9d..94bdc46e 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -72,4 +72,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 67f1631c547c2b5c49c29ea5ce22af5247b6ea79 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Wed, 23 Oct 2024 16:07:46 +0200 Subject: [PATCH 3/3] update --- .github/workflows/dependencies.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 94bdc46e..2f969412 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -6,8 +6,6 @@ on: schedule: # Run weekly - cron: 0 0 * * MON - workflow_dispatch: - # Needed so we can run it manually env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}