Improve cron schedule warning message (#227)

This commit is contained in:
eric sciple
2025-12-04 13:31:20 -06:00
committed by GitHub
parent dfb411f71e
commit 4dd678cf30
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -211,7 +211,8 @@ jobs:
expect(result.length).toBe(1); expect(result.length).toBe(1);
expect(result[0]).toEqual({ expect(result[0]).toEqual({
message: "Runs every minute. Note: Actions schedules run at most every 5 minutes.", message:
'Actions schedules run at most every 5 minutes. "*/1 * * * *" (runs every minute) will not run as frequently as specified.',
severity: DiagnosticSeverity.Warning, severity: DiagnosticSeverity.Warning,
code: "on-schedule", code: "on-schedule",
codeDescription: { codeDescription: {
@@ -281,7 +282,7 @@ jobs:
expect(result.length).toBe(1); expect(result.length).toBe(1);
expect(result[0]?.severity).toBe(DiagnosticSeverity.Warning); expect(result[0]?.severity).toBe(DiagnosticSeverity.Warning);
expect(result[0]?.message).toContain("Note: Actions schedules run at most every 5 minutes."); expect(result[0]?.message).toContain("Actions schedules run at most every 5 minutes.");
}); });
it("invalid YAML", async () => { it("invalid YAML", async () => {
+1 -1
View File
@@ -247,7 +247,7 @@ function validateCronExpression(diagnostics: Diagnostic[], token: StringToken):
// Check if the cron specifies an interval less than 5 minutes // Check if the cron specifies an interval less than 5 minutes
if (hasCronIntervalLessThan5Minutes(cronValue)) { if (hasCronIntervalLessThan5Minutes(cronValue)) {
diagnostics.push({ diagnostics.push({
message: `${description}. Note: Actions schedules run at most every 5 minutes.`, message: `Actions schedules run at most every 5 minutes. "${cronValue}" (${description.toLowerCase()}) will not run as frequently as specified.`,
range: mapRange(token.range), range: mapRange(token.range),
severity: DiagnosticSeverity.Warning, severity: DiagnosticSeverity.Warning,
code: "on-schedule", code: "on-schedule",