-
Notifications
You must be signed in to change notification settings - Fork 19
81 lines (69 loc) · 2.46 KB
/
Copy pathscheduled-bump-cargo-lock.yml
File metadata and controls
81 lines (69 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: scheduled-bump-cargo-lock
on:
schedule:
- cron: '0 0 * * 6' # Runs every Saturday at 00:00 UTC
workflow_dispatch:
defaults:
run:
shell: bash -xe {0}
permissions:
contents: write
pull-requests: write
jobs:
bump-cargo-lock:
runs-on: ubuntu-24.04
env:
DEVSHELL: .
strategy:
fail-fast: false
matrix:
include:
- name: compatible
cmd: cargo upgrade
- name: incompatible
cmd: cargo upgrade --incompatible
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 1
- name: Generate Unique Branch Name
id: branch-name
run: echo "branch_name=bump-cargo-lock-${{ matrix.name }}-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
- uses: nixbuild/nix-quick-install-action@9f63be77f412a248c9d9a65a4c82cf066cdf8f0c
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Populate the nix store
run: |
nix develop $DEVSHELL --command echo
- name: Bump Cargo.lock, Cargo.toml
run: |
nix develop $DEVSHELL --command cargo update
nix develop $DEVSHELL --command ${{ matrix.cmd }}
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit Changes
run: |
git checkout -b ${{ steps.branch-name.outputs.branch_name }}
git add Cargo.lock Cargo.toml
if [ -n "$(git status --porcelain)" ]; then
git commit -m "chore: Bump Rust dependencies"
git push origin ${{ steps.branch-name.outputs.branch_name }}
OWNER=$(echo "${{ github.repository }}" | cut -d'/' -f1)
REPO=$(echo "${{ github.repository }}" | cut -d'/' -f2)
curl -v --fail -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/$OWNER/$REPO/pulls \
-d '{
"title": "Bump '${{ matrix.name }}' dependencies",
"head": "'${{ steps.branch-name.outputs.branch_name }}'",
"base": "main",
"body": ""
}'
else
echo "No changes to commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PR_RW }}