Skip to content

Commit 88061ff

Browse files
authored
ci: Allow clippy to resolve new lints more quickly (#2821)
1 parent a7f0161 commit 88061ff

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ on:
66
branches:
77
- main
88
schedule:
9-
# Run daily job at 8:00 PM PT
10-
- cron: '0 3 * * *'
9+
# Run daily job at 8:00 AM PT.
10+
# The workflow is run in the morning to allow for the clippy job to resolve lints from new Rust
11+
# versions in a timely manner.
12+
- cron: '0 15 * * *'
13+
workflow_dispatch:
1114

1215
name: ci
1316

@@ -119,12 +122,20 @@ jobs:
119122
120123
- uses: camshaft/rust-cache@v1
121124

125+
- name: Determine if a PR should be opened
126+
id: should_fix
127+
run: |
128+
if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
129+
echo "SHOULD_FIX=true" >> "$GITHUB_OUTPUT"
130+
else
131+
echo "SHOULD_FIX=false" >> "$GITHUB_OUTPUT"
132+
fi
133+
122134
# TODO translate json reports to in-action warnings
123135
- name: Run cargo clippy on all workspaces
124136
run: |
125-
# Clippy bot only runs on schedule event
126137
CLIPPY_FIX_FLAG=""
127-
if [ "${{ github.event_name }}" == "schedule" ]; then
138+
if [ "${{ steps.should_fix.outputs.SHOULD_FIX }}" == "true" ]; then
128139
CLIPPY_FIX_FLAG='--fix --allow-dirty'
129140
fi
130141
@@ -137,7 +148,7 @@ jobs:
137148
done
138149
139150
- name: Create clippy pull request
140-
if: github.event_name == 'schedule'
151+
if: steps.should_fix.outputs.SHOULD_FIX == 'true'
141152
uses: peter-evans/create-pull-request@v7
142153
with:
143154
title: 'chore: clippy lint updates'

0 commit comments

Comments
 (0)