-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
64 lines (61 loc) · 1.91 KB
/
action.yml
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
name: Cargo Upgrade
description: Upgrade Cargo.toml dependencies and create a pull request
inputs:
cargo-edit-version:
description: The version of cargo-edit to use. Defaults to ~0.12
required: false
default: ~0.12
extra-flags:
description: Extra flags to pass to cargo-upgrade. For example `-i allow`.
required: false
default: ""
token:
description: The GitHub token to use for creating the pull request
required: true
runs:
using: composite
steps:
- name: Install cargo-edit
shell: bash
run: cargo install cargo-edit --version ${{ inputs.cargo-edit-version }}
- name: Run cargo upgrade
shell: bash
run: cargo upgrade ${{ inputs.extra-flags }}
- name: Run cargo update
shell: bash
run: cargo update
- name: Check if any files changed
id: check
shell: bash
run: |
changed=$(git status --porcelain)
if [ -z "$changed" ]; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- if: steps.check.outputs.changed == 'true'
name: Checkut to a new branch
shell: bash
run: git checkout -b ${{ github.actor }}/chore/upgrade-dependencies-${{ github.run_id }}
- if: steps.check.outputs.changed == 'true'
name: Configure git
shell: bash
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
- if: steps.check.outputs.changed == 'true'
name: Commit changes
shell: bash
run: |
git add .
git commit -m "chore: upgrade dependencies"
- if: steps.check.outputs.changed == 'true'
name: Create pull request
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
run: gh pr create --fill -H $(git branch --show-current)
branding:
icon: arrow-up-right
color: green