Skip to content

Conversation

@lucasgonze
Copy link
Contributor

Fixes #83

Signed-off-by: Lucas Gonze lucas@gonze.com

Fixes mheap#83

Signed-off-by: Lucas Gonze <lucas@gonze.com>
.parse(process.argv);

const filename = program.args[0];
const filename = program.args[0];
Copy link
Owner

Choose a reason for hiding this comment

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

Please run npm run lint-fix to ensure that formatting is correct

[onlyOwner,onlyRepo] = parts;

parts = onlyRepo.split("@");
if( 2 == parts.length ){
Copy link
Owner

Choose a reason for hiding this comment

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

parts.length == 2 here please, we don't use yoda conditions anywhere else

}
[onlyOwner,onlyRepo] = parts;

parts = onlyRepo.split("@");
Copy link
Owner

Choose a reason for hiding this comment

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

Variable shadowing here. Could we use a more descriptive (and different) variable name?

const owner = action.owner;
const repo = action.repo;
const pinned = action.pinnedVersion;
const pinned = onlyVersion ? onlyVersion : action.pinnedVersion;
Copy link
Owner

Choose a reason for hiding this comment

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

Could you add a test in findRefOnGitHub.test.js that covers this change?

continue;
}

if (onlyOwner && actions[i].owner !== onlyOwner ){
Copy link
Owner

Choose a reason for hiding this comment

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

Please extract this in to another file (e.g. checkSelectOnly.js) and write unit tests.

Example module: https://github.com/mheap/pin-github-action/blob/main/checkAllowedRepos.js
Example tests: https://github.com/mheap/pin-github-action/blob/main/checkIgnoredRepos.test.js

continue;
}

if (onlyRepo && onlyRepo !== "*" && actions[i].repo !== onlyRepo ){
Copy link
Owner

Choose a reason for hiding this comment

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

Rather than checking * explicitly, use matcher like the existing functionality

@mheap
Copy link
Owner

mheap commented Jun 25, 2022

@lucasgonze Added a few comments. Please also update the README with usage instructions

@lucasgonze
Copy link
Contributor Author

FYI I have not forgotten this. I have made progress but am mainly on vacation so don't anticipate finishing until after I get back in 2-3 weeks.

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.

feature request: look up a hash by version

2 participants