Update snapshot actions to fail if data doesn't update#39
Conversation
|
Snapshot checks fail as expected:
|
nickreich
left a comment
There was a problem hiding this comment.
overall it looks good. one small question.
| nhsn_data[['weekendingdate']] <- substr(nhsn_data[['weekendingdate']], 1, 10); | ||
| colnames(nhsn_data) <- c('Geographic aggregation', 'Week Ending Date', 'Total Influenza Admissions', 'Total COVID-19 Admissions'); | ||
| max_date <- lubridate::ymd(max(nhsn_data[['Week Ending Date']])); | ||
| if (max_date < lubridate::floor_date(Sys.Date(), 'week') - 1L) stop(paste0('Target data is out of date \nLatest date ', max_date)); |
There was a problem hiding this comment.
Is stop() enough to have the workflow fail with an error?
There was a problem hiding this comment.
Given that the NSSP workflow failed at that step on this PR, I would say so
There was a problem hiding this comment.
is there a specific workflow run that you could point to for this? I'm wondering if using stop() could make the action fail silently - like, do we know that it would get a ❌ and be considered a "failing check". is there a difference in doing this and error()?
There was a problem hiding this comment.
An AI overview reports to me:
In R, both stop() and error() will cause a GitHub Actions step to fail because they both cause the R script to exit with a non-zero status code, which GitHub Actions interprets as a failure. There is no functional difference between the two in the context of determining the GitHub Actions step outcome.
Key Points
Exit Code: GitHub Actions determines the success or failure of a run step by its exit code. An exit code of 0 means success, while any non-zero exit code means failure.
stop() in R: This function raises an immediate error condition, which, by default, stops the execution of the R script and returns a non-zero exit code to the operating system.
error() in R: Similar to stop(), this function is used to signal a terminating error and will cause the script to exit with a non-zero status.
There was a problem hiding this comment.
For reference, I was talking about this run, which failed with a x
nickreich
left a comment
There was a problem hiding this comment.
Let's try it out. It likely won't make things worse than they are, right?
nickreich
left a comment
There was a problem hiding this comment.
sorry meant for that last review to be an approval
No description provided.