FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

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

Fix hasActionsWorkflows throwing an exception if the workflows folder doesn't exist - #3084

Merged
mbg merged 2 commits into
mainfrom
mbg/fix/hasActionsWorkflows
Sep 8, 2025
Merged

Fix hasActionsWorkflows throwing an exception if the workflows folder doesn't exist#3084
mbg merged 2 commits into
mainfrom
mbg/fix/hasActionsWorkflows

Conversation

mbg commented Sep 5, 2025

Copy link
Copy Markdown
Member

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.

mbg requested a review from a team as a code owner September 5, 2025 20:14
Copilot AI review requested due to automatic review settings September 5, 2025 20:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull Request Overview

This PR fixes a bug where the hasActionsWorkflows function would throw an exception when the .github/workflows folder doesn't exist. The fix uses the throwIfNoEntry: false option in fs.lstatSync to return undefined instead of throwing when the path doesn't exist.

  • Updated fs.lstatSync to use { throwIfNoEntry: false } option to handle non-existent directories gracefully
  • Added a test case to verify the function doesn't throw when the workflows folder is missing

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/config-utils.ts Fixed hasActionsWorkflows to handle missing workflows directory without throwing
src/config-utils.test.ts Added test to verify the function handles missing workflows folder gracefully
lib/init-action.js Generated JavaScript file (not reviewed per guidelines)

mbg merged commit 144880b into main Sep 8, 2025
278 checks passed
mbg deleted the mbg/fix/hasActionsWorkflows branch September 8, 2025 08:54
github-actions Bot mentioned this pull request Sep 9, 2025
8 tasks

krsjenswbp left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

merge

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL