Fix `hasActionsWorkflows` throwing an exception if the workflows folder doesn't exist by mbg · Pull Request #3084 · github/codeql-action

This problem was introduced in #3009 since lstatSync throws an exception by default if the filesystem object doesn't exist.

We likely didn't come across this because it requires both of the following conditions to hold:

  • There is no .github/workflows folder
  • And there is no input to languages

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.