Skip to content
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

feat: look up a hash by version #90

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucasgonze
Copy link
Contributor

Fixes #83

Signed-off-by: Lucas Gonze [email protected]

.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?

debug = log.extend("find-ref-on-github");
return new Promise(async function (resolve, reject) {
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?

@@ -33,9 +36,24 @@ module.exports = async function (
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