|
1 | | -# Automatically run `cargo update` periodically |
| 1 | +# Runs `cargo update` periodically. |
2 | 2 |
|
3 | 3 | name: dependencies |
4 | 4 |
|
5 | 5 | on: |
6 | | - schedule: |
7 | | - # Run weekly |
8 | | - - cron: "0 0 * * SUN" |
9 | | - workflow_dispatch: |
10 | | - # Needed so we can run it manually |
| 6 | + schedule: |
| 7 | + # Run weekly |
| 8 | + - cron: "0 0 * * SUN" |
| 9 | + workflow_dispatch: |
| 10 | + # Needed so we can run it manually |
11 | 11 |
|
12 | 12 | env: |
13 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
14 | | - BRANCH: cargo-update |
15 | | - TITLE: "chore(deps): weekly `cargo update`" |
16 | | - BODY: | |
17 | | - Automation to keep dependencies in `Cargo.lock` current. |
| 13 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 14 | + BRANCH: cargo-update |
| 15 | + TITLE: "chore(deps): weekly `cargo update`" |
| 16 | + BODY: | |
| 17 | + Automation to keep dependencies in `Cargo.lock` current. |
18 | 18 |
|
19 | | - <details><summary><strong>cargo update log</strong></summary> |
20 | | - <p> |
| 19 | + <details><summary><strong>cargo update log</strong></summary> |
| 20 | + <p> |
21 | 21 |
|
22 | | - ```log |
23 | | - $cargo_update_log |
24 | | - ``` |
| 22 | + ```log |
| 23 | + $cargo_update_log |
| 24 | + ``` |
25 | 25 |
|
26 | | - </p> |
27 | | - </details> |
| 26 | + </p> |
| 27 | + </details> |
28 | 28 |
|
29 | 29 | jobs: |
30 | | - update: |
31 | | - name: Update |
32 | | - runs-on: ubuntu-latest |
33 | | - timeout-minutes: 30 |
34 | | - steps: |
35 | | - - uses: actions/checkout@v4 |
36 | | - - uses: dtolnay/rust-toolchain@nightly |
37 | | - |
38 | | - - name: cargo update |
39 | | - # Remove first line that always just says "Updating crates.io index" |
40 | | - run: |
41 | | - cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a |
42 | | - cargo_update.log |
43 | | - |
44 | | - - name: craft commit message and PR body |
45 | | - id: msg |
46 | | - run: | |
47 | | - export cargo_update_log="$(cat cargo_update.log)" |
48 | | -
|
49 | | - echo "commit_message<<EOF" >> $GITHUB_OUTPUT |
50 | | - printf "$TITLE\n\n$cargo_update_log\n" >> $GITHUB_OUTPUT |
51 | | - echo "EOF" >> $GITHUB_OUTPUT |
52 | | -
|
53 | | - echo "body<<EOF" >> $GITHUB_OUTPUT |
54 | | - echo "$BODY" | envsubst >> $GITHUB_OUTPUT |
55 | | - echo "EOF" >> $GITHUB_OUTPUT |
56 | | -
|
57 | | - - name: Create Pull Request |
58 | | - uses: peter-evans/create-pull-request@v5 |
59 | | - with: |
60 | | - add-paths: ./Cargo.lock |
61 | | - commit-message: ${{ steps.msg.outputs.commit_message }} |
62 | | - title: ${{ env.TITLE }} |
63 | | - body: ${{ steps.msg.outputs.body }} |
64 | | - branch: ${{ env.BRANCH }} |
| 30 | + update: |
| 31 | + name: Update |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - uses: dtolnay/rust-toolchain@nightly |
| 36 | + |
| 37 | + - name: cargo update |
| 38 | + # Remove first line that always just says "Updating crates.io index" |
| 39 | + run: cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log |
| 40 | + |
| 41 | + - name: craft commit message and PR body |
| 42 | + id: msg |
| 43 | + run: | |
| 44 | + export cargo_update_log="$(cat cargo_update.log)" |
| 45 | +
|
| 46 | + echo "commit_message<<EOF" >> $GITHUB_OUTPUT |
| 47 | + printf "$TITLE\n\n$cargo_update_log\n" >> $GITHUB_OUTPUT |
| 48 | + echo "EOF" >> $GITHUB_OUTPUT |
| 49 | +
|
| 50 | + echo "body<<EOF" >> $GITHUB_OUTPUT |
| 51 | + echo "$BODY" | envsubst >> $GITHUB_OUTPUT |
| 52 | + echo "EOF" >> $GITHUB_OUTPUT |
| 53 | +
|
| 54 | + - name: Create Pull Request |
| 55 | + uses: peter-evans/create-pull-request@v6 |
| 56 | + with: |
| 57 | + add-paths: ./Cargo.lock |
| 58 | + commit-message: ${{ steps.msg.outputs.commit_message }} |
| 59 | + title: ${{ env.TITLE }} |
| 60 | + body: ${{ steps.msg.outputs.body }} |
| 61 | + branch: ${{ env.BRANCH }} |
0 commit comments