Skip to content

Commit

Permalink
chore: Automate weekly cargo update
Browse files Browse the repository at this point in the history
  • Loading branch information
ogenev committed Oct 11, 2023
1 parent c443ee8 commit 9e56b32
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 4 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

# This workflow is borrowed from reth: https://github.com/paradigmxyz/reth/blob/e04292247fff14ea93b4b0f6cf427bc9e4365c75/.github/workflows/dependencies.yml
# Automatically run `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.
<details><summary><strong>cargo update log</strong></summary>
<p>
```log
$cargo_update_log
```
</p>
</details>
jobs:
update:
name: Update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable

- 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<<EOF" >> $GITHUB_OUTPUT
printf "$TITLE\n\n$cargo_update_log\n" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$BODY" | envsubst >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
add-paths: ./Cargo.lock
commit-message: ${{ steps.msg.outputs.commit_message }}
title: ${{ env.TITLE }}
body: ${{ steps.msg.outputs.body }}
branch: ${{ env.BRANCH }}
4 changes: 0 additions & 4 deletions book/src/developers/contributing/rotation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ When you get to the end of your checklist, here are ideas for what to work on ne
- Respond to [Github Participating Notifications](https://github.com/notifications?query=reason%3Aparticipating)
- Review PRs that have been stuck for >24 hours
- Find a [Flamingo Issue](https://github.com/ethereum/trin/issues?q=is%3Aopen+is%3Aissue+label%3Aflamingo) that seems promising, and assign it to yourself (and the project dashbord)
- Run `cargo outdated`
- Pick one or several libraries to upgrade
- Post a PR with the new `Cargo.lock`
- If `cargo outdated` shows all libraries as up-to-date, try `cargo outdated --aggressive`
- grep code for `TODO`s. For each one you find:
- write up issue to explain what needs to be done, and a plan
- link to the TODO in the code, and any relevant context
Expand Down

0 comments on commit 9e56b32

Please sign in to comment.