mirror of
https://github.com/zizmorcore/zizmor.git
synced 2025-12-23 08:47:33 +00:00
fix: dependabot: allow 'day' field for non-weekly intervals (#1308)
This commit is contained in:
parent
96a96bcc89
commit
70d35617c2
5 changed files with 23 additions and 21 deletions
|
|
@ -442,11 +442,10 @@ impl<'de> Deserialize<'de> for Schedule {
|
|||
));
|
||||
}
|
||||
|
||||
if schedule.interval != Interval::Weekly && schedule.day.is_some() {
|
||||
return Err(custom_error::<D>(
|
||||
"`schedule.day` is only valid when `schedule.interval` is `weekly`",
|
||||
));
|
||||
}
|
||||
// NOTE(ww): `day` only makes sense with `interval: weekly`, but
|
||||
// Dependabot appears to silently ignore it otherwise. Consequently,
|
||||
// we don't check that for now.
|
||||
// See https://github.com/zizmorcore/zizmor/issues/1305.
|
||||
|
||||
Ok(schedule)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
day: monday
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# https://github.com/zizmorcore/zizmor/issues/1305
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
day: sunday
|
||||
commit-message:
|
||||
prefix: ci
|
||||
labels:
|
||||
- dependencies
|
||||
|
|
@ -115,15 +115,6 @@ fn test_schedule_cronjob_rejected_for_non_cron() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_schedule_day_only_for_weekly() {
|
||||
let err = load_dependabot_result("day-on-daily.invalid.yml").unwrap_err();
|
||||
assert!(
|
||||
err.to_string()
|
||||
.contains("`schedule.day` is only valid when `schedule.interval` is `weekly`")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_schedule_weekly_accepts_day() {
|
||||
let dependabot = load_dependabot("weekly-with-day.yml");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue