Skip to content

Check whether workflow directory exists #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @crazy-max @temenuzhka-thede
* @docker/devsecops
5 changes: 5 additions & 0 deletions .github/workflows/octoguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ jobs:
with:
script: |
const fs = require('fs');
const path = '.github/workflows';
if (!fs.existsSync(path)){
core.warning("No workflow directory found, skipping zizmor scan.");
return;
}

const workflows = fs.readdirSync('.github/workflows').filter(file => file.endsWith('.yml') || file.endsWith('.yaml'));
Copy link
Member

Choose a reason for hiding this comment

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

could be

Suggested change
const path = '.github/workflows';
if (!fs.existsSync(path)){
core.warning("No workflow directory found, skipping zizmor scan.");
return;
}
const workflows = fs.readdirSync('.github/workflows').filter(file => file.endsWith('.yml') || file.endsWith('.yaml'));
const workflowsPath = '.github/workflows';
if (!fs.existsSync(workflowsPath)){
core.warning("No workflow directory found, skipping zizmor scan.");
return;
}
const workflows = fs.readdirSync(workflowsPath).filter(file => file.endsWith('.yml') || file.endsWith('.yaml'));

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good one, thanks! Incorporated

if (workflows.length > 0) {
Expand Down