@@ -14,7 +14,6 @@ defaults:
14
14
run :
15
15
shell : bash
16
16
env :
17
- CARGO_UPGRADES_VER : --version=1.3.6
18
17
PR_TITLE : Weekly `cargo update`
19
18
PR_MESSAGE : |
20
19
Automation to keep dependencies in `Cargo.lock` current.
23
22
COMMIT_MESSAGE : " cargo update \n\n "
24
23
25
24
jobs :
25
+ waiting-on-bors :
26
+ name : skip if S-waiting-on-bors
27
+ runs-on : ubuntu-latest
28
+ steps :
29
+ - env :
30
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
31
+ run : |
32
+ # Fetch state and labels of PR
33
+ # Or exit successfully if PR does not exist
34
+ JSON=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json labels,state || exit 0)
35
+ STATE=$(echo "$JSON" | jq -r '.state')
36
+ WAITING_ON_BORS=$(echo "$JSON" | jq '.labels[] | any(.name == "S-waiting-on-bors"; .)')
37
+
38
+ # Exit with error if open and S-waiting-on-bors
39
+ if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
40
+ exit 1
41
+ fi
42
+
26
43
update :
27
44
name : update dependencies
28
45
runs-on : ubuntu-latest
@@ -93,19 +110,23 @@ jobs:
93
110
git add ./Cargo.lock
94
111
git commit --no-verify --file=commit.txt
95
112
96
- - name : edit and reopen existing pull request
113
+ - name : push
114
+ run : git push --no-verify -f -u origin cargo_update
115
+
116
+ - name : edit existing open pull request
97
117
id : edit
98
118
# Don't fail job if we need to open new PR
99
119
continue-on-error : true
100
120
env :
101
121
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
102
122
run : |
103
- gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
104
- gh pr reopen cargo_update --repo $GITHUB_REPOSITORY
123
+ # Exit with error if PR is closed
124
+ STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
125
+ if [[ "$STATE" != "OPEN" ]]; then
126
+ exit 1
127
+ fi
105
128
106
- - name : push
107
- # Must push after reopening PR because of a Github quirk
108
- run : git push --no-verify -f -u origin cargo_update
129
+ gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
109
130
110
131
- name : open new pull request
111
132
# Only run if there wasn't an existing PR
0 commit comments